Bonjour à tous,
Je travaille sur windows phone 8 et je cherche à placer des points afin de pouvoir placer un Polygon sur une image.
Il faut donc que je récupère la position d'un Tap relative au canvas.
Voici le Xaml:
1 2 3 4 5 6 7 8 9 10 11
|
<Canvas x:Name="PhotoCanvas">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Tap">
<Command:EventToCommand Command="{Binding DetectCommand, Mode=OneWay}" PassEventArgsToCommand="True" />
<Command:EventToCommand CommandParameter="{Binding ElementName=PhotoCanvas}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Image Source="{Binding Photo}" />
<Polygon Points="{Binding PointsList}" Stroke="Red" StrokeThickness="4"/>
</Canvas> |
Voici le ViewModel:
this.DetectCommand = new RelayCommand<UIElement>(DetectCommandAction);
1 2 3 4 5 6
|
public void DetectCommandAction(object e)
{
Canvas c = e as Canvas;
} |
Je cherche à obtenir dans mon action DetectCommandAction quelque chose comme un TappedEventArgs qui me permetterai d'obtenir un Point
Je sais qu'en WPF je peux faire :
1 2 3 4 5
|
public void TargetClickCommandAction(object elem)
{
System.Windows.Point mousePosition = Mouse.GetPosition((IInputElement)elem);
} |
Mais impossible sur Windows Phone 8...
Des idées ?
Merci pour votre aide
Partager