Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Silverlight Drag and Drop not working

Posted on 2011-03-16
3
Medium Priority
?
1,167 Views
Last Modified: 2012-05-11
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
        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 );
        }

Open in new window


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!
0
Comment
Question by:Cyber-Storm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
saragani earned 2000 total points
ID: 35835308
Are you doing a DragDrop.DoDragDrop anywhere in your code?
0
 

Author Comment

by:Cyber-Storm
ID: 35944020
I got around this eventually by simply finding the elements in the coordinates of where I release the item I'm dropping and if I hit a DataGridRow then I select it.

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 :)
0
 

Author Closing Comment

by:Cyber-Storm
ID: 35944034
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question