Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Drag and Drop question
2 replies. Latest Post by StephenL on May 18, 2007.
(1)
StephenL
Member
14 points
12 Posts
05-17-2007 5:53 PM |
I am implementing drag and drop to allow the user to drag around a custom control and while it almost works, if the user moves to quickly, the mouse goes off my control and I stop getting mouse move events. My current work around is to end the drag on mouse leave but I would much rather not have the mouse run away. Does anybody have any ideas? My code is below.
Thanks
Stephen
private
{
}
oldLoc = newLoc;
Mark Rid...
Contributor
2357 points
273 Posts
05-18-2007 2:28 PM |
You need to capture the mouse in your MouseLeftButtonDown event handler:sender.CaptureMouse();And to be a good citizen you should call releaseMouseCapture. Check out this MSDN article on implementing Drag and drop: http://msdn2.microsoft.com/en-us/library/bb190645.aspx-markProgram ManagerMicrosoftThis post is provided "as-is"
05-18-2007 3:19 PM |
Thanks, Mark. I did see the javascript example before posting my question but when actually coding it in C# I mistakenly tried calling CaptureMouse on the framework element returned from InitializeFromXaml instead of on the sender. That just made things worse.