Select to view content in your preferred language

CancelActive.excute does not work

595
2
06-17-2011 12:18 PM
PaulHedlund
Emerging Contributor
I am working with a custom version of the Cut command on the editor widget and I cannot get it to deactivate:

Dim editor As Editor = TryCast(LayoutRoot.Resources("SplitEditor"), Editor)
If Not editor Is Nothing Then
If editor.CancelActive.CanExecute(nothing) Then  <--- This is never True
editor.CancelActive.Execute(nothing) <--- This never fires
End If
End If

'--- XAML
<Button x:Name="btnSplitStreet" Style="{StaticResource MenuButton}"
ToolTipService.ToolTip="Split Street" Command="{Binding Cut}" Click="btnSplitStreet_Click">


<esri:Editor x:Key="SplitEditor" EditCompleted="EditorWidgetSplit_EditCompleted"
Map="{Binding ElementName=Map}"
LayerIDs="GPS, Roads"
GeometryServiceUrl="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" />
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Is your Button DataContext set to the Editor? Also, if you have Command set to Cut, you don't have to do anything extra in the Click event. Activating a command, deactivates current active command. You can also wire up to Editor.EditorActivated event to check that a command becomes active when you click the button for cut.
0 Kudos
PaulHedlund
Emerging Contributor
I think I figured it out.  It looks like I was trying to deactivate it before it was active.  I got it working now.
0 Kudos