# Other .NET Programming > Windows Presentation Foundation (WPF) & XAML forum >  Drag and Drop an item outside Main window

## cebugdev

How can i drag an item (list item) from its list and drop it outside the window and still handle the event?

Example: If i have a list controls which contains a list of filenames, then i drag 1 list item outside the main window and drop it, a message box is displayed which displays the filename.

I am planning to develop similar application which performs additional processes when an item is draged(and droped) outside the main window.

Please help.

----------


## Arjay

As long as you are performing drag drop operations within your application, you will be okay (i.e it shouldn't matter if the source/target is in a secondary window).

http://bea.stollnitz.com/blog/?s=Dra...&submit=Search

----------


## cebugdev

> As long as you are performing drag drop operations within your application, you will be okay (i.e it shouldn't matter if the source/target is in a secondary window).
> 
> http://bea.stollnitz.com/blog/?s=Dra...&submit=Search


Thats the problem, the drop target is outside of the application example; Desktop or another window. 
This feature can be found in EmEditor (http://www.emeditor.com/) wherein you can drag a tab item outside the window and another instance of the application opens.

----------


## Arjay

> Thats the problem, the drop target is outside of the application example; Desktop or another window. 
> This feature can be found in EmEditor (http://www.emeditor.com/) wherein you can drag a tab item outside the window and another instance of the application opens.


I'm not familiar with the EmEditor, nor do I see the functionality you are referring to on its website.

Can you describe the functionality you desire in detail (i.e the type of object you wish to drag, the drop target, what the expected result is)?

Dragging a tab off an application and dropping it onto the window of another application to open an instance of the first application doesn't make a whole lot of sense to me.  I can't see the benefit of doing this - please help me understand.

If I can understand this, I might be able to suggest an approach.

----------


## cebugdev

heres how EmEditor drag and drop works;
When you open a file it is displayed in a tab item similar to firefox and/or IE. 
when you drag a tab item(the file) outside of the main window(the application) 
a new instance of the Editor open which contains the file(represented in the tab).

If IE has this features it will work like this;
Web pages are arranged per tab, when you drag the tab item outside the main window
it will open a new instance of IE for the webpage dragged.

Hope you guys get the idea.

----------


## Arjay

Okay what wasn't necessarily clear was that if the tabs were being dropped on other specific applications.

Normally when you drag, as you move the mouse around, you identify drop targets.

In your case, all you need to identify is when the window or object you are over isn't a window or object in your application.  If the user releases the mouse button outside the main window, you just pass a command line parameter of the file path to the Process class and start up your application.

Presumably each tab is going to be bound to some data that contains the full path to the file.  So that when the mouse is released the path can be passed to a new instance of the app.

----------

