TreeViewDragCue displaying incorrect visual cue

3 posts, 0 answers
  1. Aaron C
    Aaron C avatar
    23 posts
    Member since:
    Sep 2009

    Posted 13 Feb 2011 Link to this post

    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. Aaron C
    Aaron C avatar
    23 posts
    Member since:
    Sep 2009

    Posted 14 Feb 2011 Link to this post

    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;
    }
  3. DevCraft banner
  4. Tsvyatko
    Admin
    Tsvyatko avatar
    833 posts

    Posted 15 Feb 2011 Link to this post

    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>>
Back to Top