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

Can we change the drag/drop tooltip when e.QueryResult = true

5 Answers 104 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 05 Apr 2012, 08:47 AM
Hi,

Im trying to change the drag/drop tooltip and I followed this post: http://www.telerik.com/help/silverlight/radtreeview-how-to-set-drag-cue-feedback-deny-drop.html

Our scenario is allow client to drop item before/after another item but we need to change the tooltip message, so my code is:private void OnDropQuery( object sender, DragDropQueryEventArgs e )
{
    var destination = e.Options.Destination as RadTreeViewItem;
    var cue = e.Options.DragCue as TreeViewDragCue;
    // Do not allow dropping inside items which start with "B", only handle cases
    // where a drop is currently allowed.
    if ( destination != null
        && e.Options.Status == DragStatus.DropDestinationQuery
        && e.QueryResult == true
        && destination.DropPosition == DropPosition.Before
        && ( destination.Item as MyViewModel ).Title.StartsWith( "B" ) )
    {
        // Debying a drop will set the cue.IsDropPossible = false
        e.QueryResult = true;
        // We only need to give a reason:
        cue.DragActionContent = "Can drop before Bs, hahaha";
    }
}

Howevere, it never worked when e.QueryResult = true.  Could you guys help me with this one, please?  Doe it work in your end or there is something at my end is wrong?


Regards

Bill

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 10 Apr 2012, 07:45 AM
Hi James,

 When setting e.QueryResult = true in Drop Query then you need to use the DropInfo event with DragStatus = DropPossible in order to set the DragActionContent:

// OnDropInfo event handler
        private void OnDropInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropPossible)
            {
                (e.Options.DragCue as TreeViewDragCue).DragActionContent = "POSSIBLE DROP ";
            }
        }
You can find this realized in the attached example. Please give it a try and let us know if it satisfies you.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
James
Top achievements
Rank 1
answered on 11 Apr 2012, 12:33 AM
Thanks Petar!  Our issue is resolved.

One more question: I found that we can only update the prefix of the tooltip message. For example,  in "drop before aaa", only the "drop before" can be updated, the header of the treeview item will always get into the tooltip.  Is there any way to change the whole tooltip message?


Regards

Bill
0
Petar Mladenov
Telerik team
answered on 13 Apr 2012, 09:53 AM
Hello James,

 Yes, this is possible. Please check out the following code and its comments:

// OnDropInfo event handler
        private void OnDropInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropPossible)
            {
                (e.Options.DragCue as TreeViewDragCue).DragActionContent = "ACTION :";
 
                //// DragTooltipContent properties are responsible to represent the second part of the informative text in the drag cue.
                //// The object placed in the content will be show using the template.
                //// The template should be set to null or other template. By default it is the same as the header template of the item.
                (e.Options.DragCue as TreeViewDragCue).DragTooltipContentTemplate = null;
                (e.Options.DragCue as TreeViewDragCue).DragTooltipContent = ": CONTENT";
            }
        }
All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Miroslav
Top achievements
Rank 1
answered on 11 May 2012, 09:38 AM
I am wondering can we remove the tooltip template  with the arrow and replace it with our custom template.And remove the cue.ItemTemplate.The desired effect is in the attached picture.
0
Petar Mladenov
Telerik team
answered on 16 May 2012, 08:02 AM
Hi Miroslav,

 The attached example shows how you can define a custom DracCueTemplate. Please let us know if this helps you or not.

Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeView
Asked by
James
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
James
Top achievements
Rank 1
Miroslav
Top achievements
Rank 1
Share this question
or