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

3 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Sep 2012

    Posted 03 Mar Link to this post

    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. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 07 Mar Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. David
    David avatar
    2 posts
    Member since:
    Sep 2012

    Posted 07 Mar in reply to Martin Link to this post

    That's exactly what I needed.  Thank you Martin!
Back to Top