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

Disable multi selection with mouse

2 Answers 278 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Antoine
Top achievements
Rank 1
Antoine asked on 01 Mar 2013, 03:45 PM
Hello Telerik fellows,

I'm currently using the RadTreeView with multiple selection mode set to active, and the internal drag n' drop also set to active.

The problem is that many of the customers are disturbed with the multiple selection while trying to perform the drag n' drop of a single node.

They click once on the node to drag, move the mouse down to drag the nodes, and they get all the nodes below selected while they just wanted to have the node dragged over those nodes.

Clearly, they would have to click first to select the node, then click again to begin the DnD, I'm not discussing the implementation which is correct from my point of view.

Anyway, in order to prevent this misusage, I'd like to selectively enable the multi-selection with ctrl/shift keyboard keys, and disabling the multi-selection with mouse.

Is it possible without re-implementing the whole multi-selection feature ?

Thanks in advance,

Antoine.

2 Answers, 1 is accepted

Sort by
0
Accepted
Svett
Telerik team
answered on 05 Mar 2013, 02:25 PM
Hello Antonie,

Thank you for writing.

You can disable multi-selection with mouse by overriding the
ProcessMouseMove method of RadTreeViewElement. You should extend the RadTreeView control do achieve that:
public class MyRadTreeView : RadTreeView
{
    public MyRadTreeView()
    {
        this.ThemeClassName = typeof(RadTreeView).FullName;
    }
 
    protected override RadTreeViewElement CreateTreeViewElement()
    {
        return new MyRadTreeViewElement();
    }
 
    public class MyRadTreeViewElement : RadTreeViewElement
    {
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(RadTreeViewElement);
            }
        }
 
        protected override bool ProcessMouseMove(MouseEventArgs e)
        {
            return false;
        }
    }
}

I hope this helps.

Kind regards,
Svett
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

Interested, but can’t attend? Register anyway and we’ll send you the recording.
0
Antoine
Top achievements
Rank 1
answered on 05 Mar 2013, 03:19 PM
Nice, tried and validated.
Tags
Treeview
Asked by
Antoine
Top achievements
Rank 1
Answers by
Svett
Telerik team
Antoine
Top achievements
Rank 1
Share this question
or