Completed
Last Updated: 15 Dec 2020 09:27 by ADMIN
Release R1 2021 (LIB 2020.3.1215)
Wardeaux
Created on: 27 Nov 2020 18:41
Category: TreeView
Type: Bug Report
1
RadTreeView: Selecting Range causes selection to Root Element (bug)

Hi,

  on the Winform Demo application, go to the TreeView demos, and selection "Selection".
1) select the "Folders" item listed under the "Inbox" item.

2) Collapse the "Inbox" item by clicking the ARROW next to the "Inbox"

3) Hold down the SHIFT key and left-mouse click on the "Outbox" item, you end up with a selection all the way up the tree to the ROOT element

1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 30 Nov 2020 07:02
Hello, Wardeaux,    

The provided detailed steps are greatly appreciated. I was able to observe the undesired behavior when the parent for the selected child node is collapsed. I confirm that it is an issue with the RadTreeView's selection.

I have logged it in our feedback portal by making this thread public on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to override the ProcessMouseDown method of the RadTreeViewElement and force expanding the parent of the selected node. The attached gif file illustrates the obtained behavior:

        public RadForm1()
        {
            InitializeComponent();
            for (int i = 0; i < 5; i++)
            {
                RadTreeNode node = new RadTreeNode("Node" + i);
                for (int j = 0; j < 3; j++)
                {
                    RadTreeNode childNode = new RadTreeNode("Child" + i + "." + j);
                    node.Nodes.Add(childNode);
                }
                this.radTreeView1.Nodes.Add(node);
            }

            this.radTreeView1.MultiSelect = true; 
        }
         
        public class CustomTreeView : RadTreeView
        {
            public override string ThemeClassName  
            { 
                get 
                { 
                    return typeof(RadTreeView).FullName;  
                }
            }

            protected override RadTreeViewElement CreateTreeViewElement()
            {
                return new CustomRadTreeViewElement();
            }
        }

        public class CustomRadTreeViewElement : RadTreeViewElement
        {
            protected override Type ThemeEffectiveType     
            { 
                get    
                { 
                    return typeof(RadTreeViewElement);     
                }
            }

            protected override bool ProcessMouseDown(MouseEventArgs e)
            {
                bool isShift = Control.ModifierKeys == Keys.Shift;
                if (isShift)
                {
                    if (this.SelectedNode.Parent != null)
                    {
                        this.SelectedNode.Parent.Expand();
                    }
                }
                return base.ProcessMouseDown(e);
            }
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Attached Files: