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

D&D combined with new Dialog freezes drag source application

0 Answers 40 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Jan Terje
Top achievements
Rank 1
Jan Terje asked on 14 Jun 2013, 01:20 PM
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?

No answers yet. Maybe you can help?

Tags
DragAndDrop
Asked by
Jan Terje
Top achievements
Rank 1
Share this question
or