Select to view content in your preferred language

Removing selection mode will stay for one more selection

612
4
03-15-2013 01:44 PM
Labels (1)
GeorgeFaraj
Frequent Contributor
Hi,

I have a toolbar item that sets selection mode to Rectangle, and another toolbar item that clears the current selection. When it clears the current selection, I want it to stop allowing me to select, until I press the former toolbar item again.

So I have this code:

private void selectTool_Click(object sender, RoutedEventArgs e)
{
 if (MapEditor.Select.CanExecute("Keyboard"))
 {
  MapEditor.SelectionMode = DrawMode.Rectangle;
  //MapEditor.Select.Execute("Keyboard");
 }
}

private void unselectTool_Click(object sender, RoutedEventArgs e)
{
 if (MapEditor.ClearSelection.CanExecute(null))
 {
  MapEditor.ClearSelection.Execute(null);
  //MapEditor.SelectionMode = DrawMode.None;
 }
 if (MapEditor.CancelActive.CanExecute(null))
 {
  MapEditor.CancelActive.Execute(null);
 }
}


The unselect tool correctly unselects everything, but still allows me to use my mouse to select one more time. When I release the mouse click, I am now in pan-mode.

Any ideas?
0 Kudos
4 Replies
KerrieScholefield
Deactivated User
Hi,

You could use try using Button Command and CommandParameter properties. Once the selection has been removed you can not select again until you click the SelectTool button. This is also demonstrated in the Selecting a FeatureLayer sample.

http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Selecting_a_FeatureLayer/02q2000...

Below is a code snippet of the ToolBar Buttons with the CommandParameter and Command set in .xaml

 
<ToolBarTray Margin="0,0,0,267" DataContext="{StaticResource MyEditor}">
            <ToolBar>
                <Button Content="SelectTool" Foreground="Black" CommandParameter="Add" Command="{Binding Select}" />
                <Button Content="UnSelectTool" Foreground="Black" CommandParameter="Remove" Command="{Binding Select}" />
            </ToolBar>
        </ToolBarTray>


Cheers,

Kerrie
0 Kudos
teamIgal
Deactivated User
I encounter the same problem.

I activate the Select command using code like CCPoston does.
The Button sample provided does not help.

Why doesn't the CancelActive command work?
Is there any way to cancel the Selection command once invoked?

Thanks!
0 Kudos
GeorgeFaraj
Frequent Contributor
Hi,

You could use try using Button Command and CommandParameter properties. Once the selection has been removed you can not select again until you click the SelectTool button. This is also demonstrated in the Selecting a FeatureLayer sample.

http://resources.arcgis.com/en/help/runtime-wpf/samples/index.html#/Selecting_a_FeatureLayer/02q2000...

Cheers,

Kerrie


Hi Kerrie,

I'm actually using the commands in my toolbar items already. I'm not saying that the button is left enabled, I'm saying that when I click the map after canceling the selection, instead of panning, it allows me to select one more time. After that one time, when I click the map, I'm in pan mode.

Thanks.
0 Kudos
teamIgal
Deactivated User
Is there any solution to this problem?

Thanks!
0 Kudos