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

TreeViewDragCue displaying incorrect visual cue

2 Answers 66 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Aaron C
Top achievements
Rank 1
Aaron C asked on 13 Feb 2011, 07:48 PM
Hello,

I am dragging from a GridView to a RadTreeView, and everything is working correctly in this case.  I would like the GridView items to also be able to drag to a RadioButton, and the expected events are firing, but the visual cue does not change from the red circle that indicates 'not allowed'.  I have set the AllowDrop property on the RadioButton, and also set RadDragAndDropManager.AllowDrag = "True".  In my DropQueryEvent handler I am setting setting the QueryResult to true.  Is there something else I am missing?  Here is code from the DropQueryEvent handler,  if I set a break point in the 'if' block the code is hit, and I don't see anything being called after this that changes the value of QueryResult.  If I release the mouse button over the RadioButton the DropInfoEvent is fired, and the correct item from the grid is passed in.  The only problem is that the visual cue is not changing to indicate that the drop is allowed.


var targetRadioButton = e.Options.Destination
as RadioButton;
 if (targetRadioButton != null)
 {
     e.QueryResult = true;
     e.Handled = false;
     return;
 }


2 Answers, 1 is accepted

Sort by
0
Aaron C
Top achievements
Rank 1
answered on 14 Feb 2011, 04:41 PM
Here is the code I ended up using in case anyone else runs into this:

if (targetRadioButton != null)
{
    e.QueryResult = true;
    ((TreeViewDragCue)e.Options.DragCue).IsDropPossible = true;
    ((TreeViewDragCue)e.Options.DragCue).DragActionContent = "Send to Recycle Bin";
    e.Handled = true;
    return;
}
0
Tsvyatko
Telerik team
answered on 15 Feb 2011, 09:49 AM
Hello Aaron C,

I am glad that you have find out the solution for this scenario. Indeed, since DnD logic does not know the type of the dragCue and its properties its state needs to be controlled in the Drag/Drop events manually.

I would like also to share this help article explaining dragging between treeview to other controls. Since its default drag cue is TreeViewDragCue the idea can be applied in other scenarios where TreeViewDragCue is used.

Regards,
Tsvyatko
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
DragAndDrop
Asked by
Aaron C
Top achievements
Rank 1
Answers by
Aaron C
Top achievements
Rank 1
Tsvyatko
Telerik team
Share this question
or