I'm testing out the Drag and Drop framework and I've run into a bit of a problem which I'm hoping someone can help with.
I have a situation where I want to be able to drag a control to multiple places on other views. I'm using a layout manager simular to the Dock control with Panes and each Pane contains a seperate view/view model.
I noticed that the "Drop" event is on the DragSource and not the DropTarget which confuses me. Why wouldn't you have the drag events on the DragSource and the Drop events on the DropTarget.
I need to be able to drag an item from one view to another and hence implement the drag on the source and the drop event on the target as the drop could be any number of destination views.
Can someone please help?
Hello,
The DragDropEventArgs of the Drop event exposes a DropTarget property that gives you the information regarding the element onto which the drop will be performed. By using that property you can perform the needed operations in the Drop handler in the view that contains the drag source. I have created a sample application for you that demonstrates how you can use the Drag and Drop Framework in order to drag items between two UserControls that are in XamDockManager’s ContentPanes.
If you need any further assistance please do not hesitate to ask.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks for the reply, much appreciated.
The example your've suplied works well, but I was hoping for the drop event to be fired on the target view, not the drag source view.
My reason for this is, using Prism, I've created an application which contains lots of individual "widgets" which are placed using the Dock Manager in their own Pane. Each widget is a seperate Silverlight application brought in "on-demand" as the users wants it.
The way your drag and drop works is troublesome as it's very important each view has no-link to any other view or pane. So for example, I might drag an object of type "WishlistItem" from a GridView on View1 to a Chart on View2, then from the same GridViw on View1 to a TreeMap on View3, etc, etc.
I was hoping for a seperation of the drag / drop functionality in the framework as the way it's currently implemented it looks like View1 would need to check if the DropTarget was a Chart, TreeMap, Grid, etc, which would be endless.
Is this correct, or is there something I'm missing?