Highlight node based on raddock document selection

3 posts, 1 answers
  1. Ian
    Ian avatar
    61 posts
    Member since:
    Jul 2010

    Posted 11 Oct 2011 Link to this post

    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. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 17 Oct 2011 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ian
    Ian avatar
    61 posts
    Member since:
    Jul 2010

    Posted 17 Oct 2011 Link to this post

    Many thanks Nikolay. That 's help a lot.

    Regards
    Ian
Back to Top