D&D combined with new Dialog freezes drag source application

1 posts, 0 answers
  1. Jan Terje
    Jan Terje avatar
    1 posts
    Member since:
    Jun 2013

    Posted 14 Jun 2013 Link to this post

    Hi.

    We have an implementation of Drag&Drop of items from outlook to a treeview using the telerik DragDropManager.

    xaml code:
    <telerik:RadTreeView ItemPrepared="OnItemPrepared" .../>

    code-behind:
            protected void OnItemPrepared(object sender, RadTreeViewItemPreparedEventArgs e)
            {
                if (e.PreparedItem.AllowDrop)
                {
                    e.PreparedItem.DragEnter += OnPreparedItemDragEnter;
                    e.PreparedItem.Drop += OnPreparedItemDrop;
                }
            }


    We then have a function : OnPreparedItemDrop(object sender, DragEventArgs args)
    ...Where I want to launch a new dialog and add some metadata to the files dragged in.

    When using a dialog.ShowDialog() the calling thread here freezes. This causes the source application(outlook) to be completely unresponsible until my dialog has been closed and the function returns. It also leaves the mouse cursor in "drag-drop" mode when hovering stuff outside my application.

    I am fond of this style of opening and handlign dialog outputs:

    if(dialog.ShowDialog == true)
    {
        DoSomething();
    }
    DoCleanup();



    The alternative I see at the moment is to add logic to the view cancel/close events to do cleanup, or mess with the dispatcher and threading. What is the proper approach here?
Back to Top