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

IsDragEnabled Question and Help

2 Answers 87 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 14 Dec 2016, 03:30 PM

Hello,

I am trying to implement the same scenario as in this link. 

http://docs.telerik.com/devtools/wpf/controls/radtreeview/populating-with-data/data-binding-to-object

I want to move the item within the same division and don't allow to move to other division.

How can I restrict IsDragEnabled at HierarchicalDataTemplate level ?

2 Answers, 1 is accepted

Sort by
0
crazy05
Top achievements
Rank 1
answered on 15 Dec 2016, 02:21 PM
Any help ?
0
Petar Mladenov
Telerik team
answered on 16 Dec 2016, 04:19 PM
Hi Ram,

You can handle the DragDropManager.DragOver event and implement your custom logic there.
Let's have, for example our DragDropBetweenTreeViews project. Once you have the options object:

private void OnApplicationTreeDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
      {
          var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
          if (options == null)
              return;

you have DropTargetItem property which will tell you that the dragged object is above branch (division) X different from your source division Y. (divisions can be models in your application). To deny the drop you need to set::
options.DropAction = DropAction.None;
and then update the drag visual:
options.UpdateDragVisual();

We hope this moves you in the right direction.

Regards,
Petar Mladenov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TreeView
Asked by
crazy05
Top achievements
Rank 1
Answers by
crazy05
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or