How to set gridlines in winTree with multicolumn? and how to set background for selected node and its children?
Thanks!
The SelectedNodeAppearance is only applied to nodes that are currently selected. If you want the child nodes to exhibit a particular appearance when the parent node is selected, you would have to do something like this:
private void ultraTree1_BeforeSelect(object sender, BeforeSelectEventArgs e){ UltraTree tree = sender as UltraTree;
SelectedNodesCollection lastSelection = tree.SelectedNodes; SelectedNodesCollection newSelection = e.NewSelections;
foreach( UltraTreeNode node in lastSelection ) { if ( node.HasNodes ) node.Nodes.Override.NodeAppearance = null; }
foreach( UltraTreeNode node in newSelection ) { if ( node.HasNodes ) node.Nodes.Override.NodeAppearance = node.Override.SelectedNodeAppearance; }}
after I added the following 2 lines node.Override.SelectedNodeAppearance.BackColor = Color.Green;node.Nodes.Override.SelectedNodeAppearance.BackColor = Color.Green;
only selectedNode's color is modified, but its children are not.
You can get "gridlines" by setting the BorderStyleCell property of the UltraTreeColumnSet class.
The Override class exposes a SelectedNodeAppearance property; the Override is exposed by UltraTreeNode, TreeNodesCollection, NodeLevelOverrides, and UltraTree. You could set the selected appearance for a node and its children like so:
node.Override.SelectedNodeAppearance.BackColor = Color.Green;node.Nodes.Override.SelectedNodeAppearance.BackColor = Color.Green;