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

TreeView - How to modify the Drag/Drop Drag Tooltip target part

2 Answers 431 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 03 Mar 2016, 05:12 PM

Hello,

I have a RadTreeView that has different item HierarchicalDataTemplates based on the data type.  One of the templates calls for multi-column items.  Whenever I am performing a drag/drop operation the tooltip target appears to be taking the existing template (maybe put into a horizontal stack panel) and showing the info.  (See attachment)  This is not the results I want as it's even showing hidden buttons (X) that should only appear on hover.  

So my question is how can I update the circled part of the tooltip to only show the label (with the styling such as bold removed as well)?

 

Thank you for your assistance.

 

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 07 Mar 2016, 10:36 AM
Hi David,

You can customize the drag visual tooltip of the treeview using the TreeViewDragVisual's DropTargetTemplate property. Basically, you can subscribe for the drag over event of the treeview drag behavior and in its handler get the drag visual and set its drop target template.
DragDropManager.AddDragOverHandler(this.tree, OnTreeDragOver, true);
 //-----------------------------------//
private void OnTreeDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
    var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
    if (options != null)
    {
        var dragVisual = (TreeViewDragVisual)options.DragVisual;
        dragVisual.DropTargetTemplate = (DataTemplate)this.Resources["dropTargetTemplate"];
    }
}
You can take a look at the Customize the TreeViewDragVisual help article which demonstrates how to customize the appearance of the drag visual element.

Please let me know if you need any further assistance.

Regards,
Martin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 07 Mar 2016, 04:03 PM
That's exactly what I needed.  Thank you Martin!
Tags
TreeView
Asked by
David
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
David
Top achievements
Rank 1
Share this question
or