Hi. I have some buttons in one of my ribbon tabs and I am assigning a command to it. By adding CommandBindings to my RibbonWindow, it works fine, but I have to write code that looks like the following:
this.CommandBindings.Add( new CommandBinding( RibbonApplicationCommands.CalculateDistance,
_mapTab.OnCalculateDistanceCommand_Execute,
_mapTab.OnCalculateDistanceCommand_CanExecute ) );
So the methods are within my _mapTab class (which is of type ribbon tab)
By the way, the CanExecute method in this case just has one line of code: e.CanExecute=true;
My issue is that I'd like to do this code within my "_mapTab" so that it's all contained within that class. But when I do the same above bindings in my "_mapTab" class (i.e. say "this.CommandBindings.Add(...) from within my _mapTab class), the button associated with the command is always disabled, even though I'm saying e.CanExecute=true. In other words, it doesn't seem to be registering the command correctly...
Is my original design (i.e. assigning the bindings to my RibbonWindow) the better one?
[Modified at 09/26/2007 04:28 PM]
this.CommandBindings.Add( new CommandBinding( RibbonApplicationCommands.CalculateDistance,
_mapTab.OnCalculateDistanceCommand_Execute,
_mapTab.OnCalculateDistanceCommand_CanExecute ) );
So the methods are within my _mapTab class (which is of type ribbon tab)
By the way, the CanExecute method in this case just has one line of code: e.CanExecute=true;
My issue is that I'd like to do this code within my "_mapTab" so that it's all contained within that class. But when I do the same above bindings in my "_mapTab" class (i.e. say "this.CommandBindings.Add(...) from within my _mapTab class), the button associated with the command is always disabled, even though I'm saying e.CanExecute=true. In other words, it doesn't seem to be registering the command correctly...
Is my original design (i.e. assigning the bindings to my RibbonWindow) the better one?
[Modified at 09/26/2007 04:28 PM]