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

Desactivate drop on root level

1 Answer 27 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
ATHOME asked on 07 Jul 2014, 04:39 PM
I have several treeviews generated by a ItemsControl, and I'd like to disable the ability to drop an element on the root level. (Basically, you can reorder subtrees, but you can't create a new root).

I tried attaching an event to drag and drop of the tree view like that 

 for (int i = 0; i < Trees.Items.Count; i++)
                var uiElement =
                if (uiElement == null)
                RadTreeView dependencyObject = VisualTreeHelper.GetChild(uiElement,0) as RadTreeView;

But the event does not seem to fire. 

Any hint on how to achieve what I want ?

1 Answer, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 09 Jul 2014, 08:54 AM

I tested your code but I wasn't able to reproduce the behavior where the events doesn't fire. Can you please double check that you have set the IsDragDropEnabled property of the RadTreeView to true? I also attached a sample project, can you please give it a try and let me know if I am missing something?

As for forbidding drop on specific RadTreeViewItem you can set the item's IsDropAllowed property to false. This property indicates whether the tree item can accept data that the user drags onto it.

In addition you can take a look at the Drag and Drop and the Disable Drop at Specific Location help articles.

Please let me know if you need any further assistance.

Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question