MouseDragElementBehavior Behavior (Compact 2013)
3/26/2014
You can easily add the functionality of dragging an item on a screen to an element by adding a MouseDragElementBehavior behavior. For instance, the following XAML example shows you how to create a Rectangle that can be dragged on the display screen with the mouse.
<Rectangle Fill="#FF4E4EA8" HorizontalAlignment="Left" Height="100" Stroke="Black"
VerticalAlignment="Top" Width="100" Margin="50,62,0,0" StrokeThickness="10">
<!-- This collection element might exist if you have already added other behaviors. -->
<i:Interaction.Behaviors>
<!-- Invoke the MouseDragElementBehavior, optionally constraining its movement. -->
<ei:MouseDragElementBehavior ConstrainToParentBounds="True"/>
</i:Interaction.Behaviors>
</Rectangle>
Important
Note that the MouseDragElementBehavior behavior is not supported for any controls that handle MouseClick events (for example, Button, TextBox, and ListBox controls). If you need the ability to drag a control of one of these types, make that control a child of a control that can be dragged (such as a Border). You can then apply the MouseDragElementBehavior behavior to the parent element.
See Also
Concepts
Expression Blend Behaviors in XAML for Windows Embedded
Behaviors, Actions, and Triggers