Remove the "not allowed" icon on drag

3 posts, 1 answers
  1. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 22 May 2017 Link to this post

    Hello Telerik,


    I am implementing a feature which consists of a list of user controls that can be dragged to dock panels.

    however, as you can see in the attached picture, there is this red "not allowed"-like icon showing, although the functionality works fine.

    I just need to remove that icon. is there a way to do so?


    Thank you

  2. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1546 posts

    Posted 25 May 2017 Link to this post

    Hi Jacob,

    To hide the icon you can change the DropAction of the drag payload of the treeview. To do this you can subscribe the drop target to the DragDropManager.DragOver event. Then get the TreeViewDragDropOptions provided by the event arguments and set their DropAction to a value different than None.

    For example:
    DragDropManager.AddDragOverHandler(this.dropTargetControl, OnDropTargetDragOver, true);

    private void OnDropTargetDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
        if (options != null)
            options.DropAction = DropAction.Copy;               
    You can also use the DragEnter and DragLeave of DragDropManager instead of DragOver. Check the attached project for a sample implementation.

    Alternatively you can get the DragVisual (TreeViewDragVisual) element from the TreeViewDragDropOptions and set its IsDropPossible to True.

    If you want to completely hide the tooltip that shows the icon you can get the DragVisual 
    var dragVisual = (TreeViewDragVisual)options.DragVisual;
    dragVisual.DragTooltipVisibility = Visibility.Collapsed;

    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Jacob
    Jacob  avatar
    49 posts
    Member since:
    Apr 2016

    Posted 26 May 2017 in reply to Martin Ivanov Link to this post

    Thank you Martin. Your solution works perfectly.

Back to Top