Here is a code where you can track what is the position of X and Y co-ordinates-
1) I have applied the behavior by code. The class MouseDragElementBehavior contains few events. One of them is DragFinished. You can get the co-ordinates within that event as well. Look at the code below-
Pravinkumar...
Contributor
5034 Points
801 Posts
Re: MouseDragElementBehavior: accessing coordinates
Aug 15, 2009 02:24 PM | LINK
Hi,
Here is a code where you can track what is the position of X and Y co-ordinates-
1) I have applied the behavior by code. The class MouseDragElementBehavior contains few events. One of them is DragFinished. You can get the co-ordinates within that event as well. Look at the code below-
USER Control-
<
UserControlxmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns
:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns
:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Microsoft.Expression.Interactions"x
:Class="SampleProject.MainPage"Width
="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"><TextBlock x:Name="txtcordinates" FontSize="20" Foreground="Blue"/>
<Rectangle Fill="Red" Stroke="Black" Margin="144,88,160,192" x:Name="rect1"/> </Grid></
UserControl>UserControl Code in CS file-
Import a namespace in .CS file codebehind of MainPage.XAML
using
Microsoft.Expression.Interactivity.Layout;Silverlight 3.0