SelectedNodeChanged not deselecting node

2 posts, 0 answers
  1. Ralph
    Ralph avatar
    13 posts
    Member since:
    Jan 2008

    Posted 12 Feb 2010 Link to this post


    I use RadControls for WinForms Q3 2009 SP1.

    In order to add a node to an existing node I need to know what the last selected node was, and SelectedNodeChanged works perfectly for this.

    The problem is when I want to add a node to the root of the TreeView, I click on the TreeView itself (not on a node) and SelectedNodeChanged is *not* fired with RadTreeViewEventArgs.Node = null.  Any idea how I can get around this?

  2. Victor
    Victor avatar
    1358 posts

    Posted 12 Feb 2010 Link to this post

    Hello Ralph,

    You can set the SelectedNode to null when no node is clicked:

    void tv_MouseDown(object sender, MouseEventArgs e)
        RadTreeView tv = (RadTreeView)sender;
        RadElement elementUnderMouse = tv.ElementTree.GetElementAtPoint(e.Location);
        if (!(elementUnderMouse is TreeNodeUI))
            tv.SelectedNode = null;

    Please write again if you have other questions.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top