CommandBindings Issue

Ribbon for WPF Forum

Posted 13 years ago by Brad Daszynski
Version: 1.0.0347
Avatar
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]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Brad,

Can you put together a small sample project that shows this happening (both cases)? We can look into it.

Also we have redesigned a lot of the internals of Ribbon for the next major version and I'd like to see if what we changed makes a difference per your sample.


Actipro Software Support

The latest build of this product (v2020.1.0) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.