Cyber-Storm
asked on
Silverlight Drag and Drop not working
Hi,
I have a Silverlight 4 app. In the app I have 2 DataGrids, I setup a MouseLeftButtonDown event on the DataGridRow to create a Label with info in it for a Drag'n'Drop event
This works fine, I get a label that pops up when I hold the left mouse button down and I can drag this label anywhere I want.
As shown above, I also have an Drop event registered to grab the label if I drop it in the next door datagrid. The problem now is, that when I drop something on the other DataGrid's Rows, they don't fire the Drop event. If I drag a file from the file system and drop it there, it fires just perfectly.
The only thing I can come up with is that there must be some call to "register" a drag event. I've tried creating DragEnter and Drop events on everything above the Target DataGridRow, being the Datagrid, StackPanels, Grids, even LayoutRoot and I've tried dropping different items but they're still not firing. Only something coming in from outside the application registers
Thanks!
I have a Silverlight 4 app. In the app I have 2 DataGrids, I setup a MouseLeftButtonDown event on the DataGridRow to create a Label with info in it for a Drag'n'Drop event
void grid_LoadingRow( object sender, DataGridRowEventArgs args )
{
args.Row.AddHandler( MouseLeftButtonDownEvent, new MouseButtonEventHandler( ( s, e ) => tableColumn_MouseLeftButtonDown( (FrameworkElement)s, e ) ), true );
args.Row.AllowDrop = true;
args.Row.Drop += new DragEventHandler( tableColumn_Drop );
}
This works fine, I get a label that pops up when I hold the left mouse button down and I can drag this label anywhere I want.
As shown above, I also have an Drop event registered to grab the label if I drop it in the next door datagrid. The problem now is, that when I drop something on the other DataGrid's Rows, they don't fire the Drop event. If I drag a file from the file system and drop it there, it fires just perfectly.
The only thing I can come up with is that there must be some call to "register" a drag event. I've tried creating DragEnter and Drop events on everything above the Target DataGridRow, being the Datagrid, StackPanels, Grids, even LayoutRoot and I've tried dropping different items but they're still not firing. Only something coming in from outside the application registers
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm very disappointed that it took 2 months for any sort of response from experts exchange specially concidering how much I'm paying for it as opposed to a free site. By paying for the service I really expect better service than the sites providing free service where you're relying on someone from the community to share their time for free.
ASKER
Sorry I didn't respond, I was on leave. I never saw the dodragdrop before (this is the first time I dealt with drag 'n drop) in any of the examples I looked at so no, I didn't use it. But I did briefly look into it and by searching for DoDragDrop I suddenly found what I should have the first time and then I'd probably never struggled. Because of that I'll mark your post as the solution, thanks :)