Wednesday, March 23, 2011

Create a Dragable object using Thumb

< Canvas>
< Thumb Name="myThumb" Canvas.Left="80" Canvas.Top="80" DragDelta="onDragDelta">
< /Canvas>


private void onDragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
Canvas.SetLeft(myThumb,Canvas.GetLeft(myThumb)
+e.HorizontalChange);
Canvas.SetTop(myThumb,Canvas.GetTop(myThumb)
+e.VerticalChange);
}

I have placed the Sample Code Here.

No comments: