Selected Event

2 posts, 1 answers
  1. Frédéric
    Frédéric avatar
    11 posts
    Member since:
    Jul 2008

    Posted 13 Aug 2008 Link to this post


    Sorry to ask you so much question but I still have a little problem.

    I'm using the Selected event and I have a problem.

    I'm using multi selection.

    >I select 1 node with the
    >Then, I click into another non selected node.

    I have the feeling that the Selected event is fired before the first node is unselected because when I go to Nodes.selected.count I have 2 node and I should have just one!

    Is it normal?

    I check the documentation and they say I should use OnSelectionChange but I'm not able to use it. (I'm not an experienced programmer... :-( )

    Can you please give me a sample code ?

    Thanks in advance for your help.


  2. Answer
    Jordan avatar
    547 posts

    Posted 15 Aug 2008 Link to this post

    Hello Frédéric,

    The current implementation of the selection functionality clears the old selection on mouse up when multi-select is on. That is due to the specifics of drag-and-drop and it is by design.

    You could try examining the selected nodes in the mouse up handler like in the code below:
    public Form1() 
                this.radTreeView1.AllowMultiselect = true
                this.radTreeView1.Selected += new EventHandler(radTreeView1_Selected); 
                this.radTreeView1.MouseUp += new MouseEventHandler(radTreeView1_MouseUp); 
            private bool selectionChanged = false
            void radTreeView1_MouseUp(object sender, MouseEventArgs e) 
                if (this.selectionChanged) 
                    this.selectionChanged = false
                    for (int i = 0; i < this.radTreeView1.SelectedNodes.Count; i++) 
            void radTreeView1_Selected(object sender, EventArgs e) 
                this.selectionChanged = true

    For a future release we will try to find a way to correct this behavior without breaking the drag and drop functionality. Unfortunately, I cannot give you a specific time frame for that at the moment.

    Kind regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
Back to Top