We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Tree Node Selection

Hi, How can I Make Tree should always have foucs (Node cannot loose the focus (blue background color). Focus should not go, even if user clicks on any control on the form. Thanks Satish

6 Replies

SG Sean Greer May 18, 2004 01:34 PM UTC

Set the HideSelection property of the TreeViewAdv to false.


AD Administrator Syncfusion Team May 18, 2004 07:48 PM UTC

Hi, Once again, thanks a lot for your response, Sean. Doing the following : this.treeViewAdv1.HideSelection = false; will ensure that the selected node is always highlighted. But when the TreeViewAdv loses focus, the selection rectangle gets grayed out instead of being blue. Please let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.


SA Satish May 19, 2004 02:23 AM UTC

Hi Guru Patwal, but I need blue background color. Is it possible? Thanks Satish >Hi, > >Once again, thanks a lot for your response, Sean. > >Doing the following : >this.treeViewAdv1.HideSelection = false; > >will ensure that the selected node is always highlighted. But when the TreeViewAdv loses focus, the selection rectangle gets grayed out instead of being blue. Please let me know if this works for you. > >Regards, >Guru Patwal >Syncfusion, Inc.


AD Administrator Syncfusion Team May 19, 2004 11:06 AM UTC

Hi Satish, Yes, you could do so by setting the following properties : this.treeViewAdv1.InactiveSelectedNodeBackground = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.MediumBlue); this.treeViewAdv1.InactiveSelectedNodeForeColor = SystemColors.ActiveCaptionText; Please try this and let me know if this works for you. Thanks for considering Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


SS Sharad Sharma July 5, 2005 05:41 AM UTC

Hi Guru Patwal, Can you help me in following code: *************************** private void buttonFindInstruments_Click(object sender, System.EventArgs e) { bool found=false; for (int index = 0 ; index < treeViewAdvProfiles.Nodes.Count ; index++ ) { if (searchNode(treeViewAdvProfiles.Nodes[index])) { found=true; break; } } if (found) { MessageBox.Show("found"); } else { MessageBox.Show("not found"); } } public bool searchNode(TreeNodeAdv treeNode) { string nodeText; bool found=false; for (int index = 0 ; index < treeNode.Nodes.Count ; index++ ) { nodeText = treeNode.Nodes[index].Text; try // temporarily written { if (String.Compare(nodeText, comboBoxInstruments.Text, true)==0) { found=true; // Highlight Node break; } else { searchNode(treeNode.Nodes[index]); } } catch(Exception ex) { ex=ex; // just to trace } } return (found); } *************************** The above searches a node in the treeview for comboBoxInstruments.Text. This code works fine, except, pointing and highlighting the node which is found (matched). I want to write the required code at comment (// Highlight Node) Thanks, Sharad [KAPIL] >Hi Satish, > >Yes, you could do so by setting the following properties : > >this.treeViewAdv1.InactiveSelectedNodeBackground = new Syncfusion.Drawing.BrushInfo(System.Drawing.Color.MediumBlue); > >this.treeViewAdv1.InactiveSelectedNodeForeColor = SystemColors.ActiveCaptionText; > >Please try this and let me know if this works for you. Thanks for considering Syncfusion products. > >Regards, >Guru Patwal >Syncfusion, Inc.


SS Sharad Sharma July 5, 2005 07:26 AM UTC

Found solution for abobe issue: just place following code at comment (// Highlight Node) treeViewAdvProfiles.SelectedNode = treeNode.Nodes[index]; treeViewAdvProfiles.Focus(); ...

Loader.
Live Chat Icon For mobile
Up arrow icon