ccposton

Removing selection mode will stay for one more selection

Discussion created by ccposton on Mar 15, 2013
Latest reply on Apr 2, 2013 by teamigal
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?

Outcomes