Silverlight Create draggable control over image
I want to build some GUI where an image is presented, and the user should pick nd/or adjust some points (ellipses) according to the image. Basically, like a map control, when we want to mark some points or make a route, but instead of a map, a picture must be presented. The final locations will be used for image processing. Is there a built-i开发者_开发技巧n silverlight functionality to do this? How should be the best way?
regards
for the Drag & Drop part, there is no built-in functionality in Silverlight so far (at least not for UIElements). But there are many implementations out there that provide this functionality, e.g. the DragDropManager on Codeplex: http://silverlightdragdrop.codeplex.com/
These "workarounds" usually use mouse events and CaptureMouse/ReleaseMouseCapture to implement Drag & Drop behavior on UIElements.
Once you have Drag & Drop in your app, the rest should not be too hard. I'd place the image inside a Canvas and then move the markers around on that Canvas using the functionality provided by e.g. the Codeplex Drag & Drop implementation. Basically, all you have to do is set Canvas.Top/Canvas.Left for a marker based on where the mouse is.
Cheers, Alex
精彩评论