winforms - Avoid expansion of certain TreeNode nodes upon TreeNode.ExpandAll? -
nobody asked before:
what efficient way avoid expansion of treenode class descendants in winforms treeview when user "expand all" thing, still let him expand such nodes clicking on + symbol?
sure can handle beforeexpand, have hard time setting e.cancel true if expandall operation. wonder how can determine this? subclass treeview , override expandall -- 1 cannot overriden...
seems standard .net treeview doesn`t have way other described: trigger flag before expandall, handle beforeexpand , enable e.cancel appropriate nodes when flag enabled.
as expandall method isn`t virtual have these ways follow:
- inherit treeview class , add expandallex method trigger flag. no 1 because need cast tree class everywhere use tree instance.
- add extension method treeview class use tree.tag property flag. more useful way minimal changes in existing code.
Comments
Post a Comment