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
1930
ButtonTool Command
posted

Hi

I'm using MVVM Light toolkit in my SL project.

I have a page(with the ViewModel setted as DataContext) with an XamRibbon which contains some ButtonTools and i'm setting the Command property of the ButtonTool to a RelayCommand declared in ViewModel. But the command is not triggered.

I did the same a Silverlight Button and it works!

Some could help me please?

Parents
  • 30945
    Offline posted

    Hello,

     

    Thank you for your email. I have been looking into the behavior that you have described and it seems that the reason for the command to not execute is that the ButtonTool is not actually part of the visual tree (it is not a framework element). What I can suggest, in order to bind the Command  of the ButtomTool, is creating an instance of your ViewModel in the Resources of the root element and use the Source of the binding in order to access command. I have created a sample application for you, that demonstrates how you can implement this approach.

     

    Another approach that you can use in order to implement the functionality that you are looking for is following the approach that Devin Rader has described at the following blog post: https://ko.infragistics.com/community/blogs/b/devin_rader/posts/extending-a-xamribbon-buttontool-to-execute-icommands

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    ButtonToolCommandBinding.zip
Reply Children