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

Drag and Drop between TreeView without Visual Queue on one side

1 Answer 33 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 08 Dec 2010, 10:45 PM
I have a two TreeView controls, one on the left side and one on the right side. The users should be able to drag items from the left side to the right side, but not the other way around. I have this functionality working, but I want to remove the visual elements (Drag Preview, Preview Line and Tooltip) when the drag is over the left side so that the users don't think that they are allowed to drag. 

I've tried setting the following:
IsDragPreviewEnabled="False"
IsDragTooltipEnabled="False"
IsDropPreviewLineEnabled="False"
But I still get all the visuals. I'd be fine with the visual queue that shows the red indicator saying no to the user.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 14 Dec 2010, 09:46 AM
Hello Scott,

Setting those properties on the left tree will take effect when you start your drag operation from the left tree. So if you want to forbid the drop (inside the left tree) or indicate to the user that drop is not possible you can attach a handlers to the RadDragAndDropManager's DropQuery and DropInfo events. You could experiment which one best fits your needs.

RadDragAndDropManager.AddDropInfoHandler(tree1, new System.EventHandler<DragDropEventArgs>(DropInfo));
...
or
...
tree1.AddHandler(RadDragAndDropManager.DropQueryEvent, new System.EventHandler<DragDropQueryEventArgs>(DropQuerry), true);
And the handlers could be something like:
private void DropInfo(object sender, DragDropEventArgs e)
{
    TreeViewDragCue cue = e.Options.DragCue as TreeViewDragCue;
    cue.IsDropPossible = false;
}
 
private void DropQuerry(object sender, DragDropQueryEventArgs e)
{
    e.QueryResult = false;
}

Hope this helps. Let me know if you need more info.


All the best,
Hristo
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
TreeView
Asked by
Scott
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or