This is a migrated thread and some comments may be shown as answers.

Highlight node based on raddock document selection

2 Answers 69 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 12 Oct 2011, 03:27 AM
Hi Telerik

I'm trying to create a standout highlight in a treeview to indicate which document in a raddock has been selected. I have created a Custom document with a DocumentNode property which points to the node in the tree which relates to the document. I'm using the Active document changed event and a TreeViewElement.Update to attempt this. THe code works for the addition of a single document but gets stuck on the next added document and won't reformat the appropriate node when I change from one document to the other by clicking on the document window tab.

The key code snippets are below:
In Active Document changed

tvMPWorkspace.TreeViewElement.Update(RadTreeViewElement.UpdateActions.StateChanged);


In Node Formatting event

if (rDockModelPackage.DocumentManager.ActiveDocument != null && ((RadCustomDocumentWindow)rDockModelPackage.DocumentManager.ActiveDocument).DocumentNode == e.Node)
{
    e.NodeElement.BackColor = Color.PaleGoldenrod;
}
else
{
    e.NodeElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}

As usual, all help gratefully received
Regards
Ian

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 17 Oct 2011, 12:25 PM
Hello Ian,

Thank you for your question.

You can achieve the desired behavior by setting and resetting the DrawFill property in the NodeFormatting event. Please find a sample project which demonstrates how the 'active' node is changes when you change the active DocumentWindow. 

I hope this helps. If you have any additional questions on the case, feel free to write back.

Regards,
Nikolay
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Ian
Top achievements
Rank 1
answered on 17 Oct 2011, 02:17 PM
Many thanks Nikolay. That 's help a lot.

Regards
Ian
Tags
Treeview
Asked by
Ian
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Ian
Top achievements
Rank 1
Share this question
or