Thanks for your answers, but it's not exactly that.
You'll find my code below to better understand.
In Xaml :
<AppBarButton Margin="0,0,-15,0"
Command="{Binding ValiderTraceCommand}"
Icon="Accept"
Label="Valider le tracé"
Style="{StaticResource DefaultAppBarButtonStyle}"
Visibility="{Binding ValiderTraceCommandIsVisible, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"
Width="100"
FontSize="10"/>
<Border Grid.Column="1"
BorderBrush="Gray"
BorderThickness="1,0,0,0">
<esriControls:MapView x:Name="mapView"
Map="{Binding Map}" Loaded="mapView_Loaded">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="GeoViewTapped">
<core:InvokeCommandAction Command="{Binding OnMapViewTappedCommand}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</esriControls:MapView>
</Border>
In View :
public bool ValiderTraceCommandIsVisible
{
get
{
return ValiderTraceCommand.CanExecute(null);
}
}
public RelayCommand ValiderTraceCommand
{
get
{
return _validerTraceCommand ?? (_validerTraceCommand = new RelayCommand(async () => await ValiderTrace(), CanValiderTrace));
}
}
private async Task ValiderTrace()
{
if (MapView.SketchEditor.CompleteCommand.CanExecute(null))
{
MapView.SketchEditor.CompleteCommand.Execute(null);
}
}
private Boolean CanValiderTrace()
{
return MapView.SketchEditor.CompleteCommand.CanExecute(null) && otherVariable;
}
public RelayCommand<object> OnMapViewTappedCommand
{
get
{
return _onMapViewTappedCommand ??
(_onMapViewTappedCommand =
new RelayCommand<object>(async mapView => await OnMapViewTapped(mapView)));
}
}
private async Task OnMapViewTapped(object mapViewInputEventArgs)
{
ValiderTraceCommand.RaiseCanExecuteChanged();
RaisePropertyChanged(() => ValiderTraceCommandIsVisible);
}
SketchEditor is initialized by :
Geometry g = await MapView.SketchEditor.StartAsync(SketchCreationMode.Polygon, true);
Here's the problem, when I click on the map, OnMapViewTapped runs before drawing.
Therefore, during the third point creation, my test detect only two point. Always one point behind.
How can I launch this test after the drawing ?