Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
MenuTool with ButtonTool Command Binding
posted

I think I must be doing something wrong and would appreciate some help. I have a xamRibbon that has a MenuTool on it that I want to contain a couple items that can be bound to ICommand's in my view model. I started by trying to use the ButtonTool, but maybe there is something better?

 

<Ribbon:MenuTool Caption="Select"
    SmallImage="Images/Select16x16.png"
    Ribbon:RibbonGroup.MaximumSize="ImageAndTextNormal">
          <Ribbon:ButtonTool Caption="All"
                    Command="{Binding SelectAllCommand}"/>
          <Ribbon:ButtonTool Caption="None"
                    Command="{Binding SelectNoneCommand}"/>
</Ribbon:MenuTool>

 

When both commands are disabled the MenuTool is disabled, and when at least on of the commands are enabled the MenuTool is enabled. However, the ButtonTool doesn't appear disabled when shown. With the MenuTool being correctly enabled/disabled tells me that the binding is being done correctly for the CanExecute, I have also verified through debugger that the command's CanExecute programming is being hit.

My problem is that the Execute part of the command is not being fired when I click on the ButtonTool. If I move the ButtonTool outside of the MenuTool it functions appropriately.

Thanks for your time!
Jerod 

Parents
No Data
Reply
  • 30945
    Offline posted

    Hello,

     

    It has been a while since you have made your  post, in case you still need of support I will be glad to help with this matter. I suppose the other community members can benefit from this answer as well.  I have created a sample application in which I added a XamRibbon with a MenuTool that contains two ButtonTools. Each ButtonTool has its Command property bound to a command and when the buttons are clicked the Execute method of the command is executed. I have tested the sample with both versions 9.2 and 10.3 and it seems to work as it supposed to.

     

    Please let me know if you can reproduce the behavior that you described with my sample application of I have missed something from your scenario.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    ButtonToolCommand.zip
Children
No Data