Search code examples
mvvmribbonicommand

WPF RibbonControl command


I just started playing around with the WPF RibbonControl library from Microsoft (October 2010 release). It seems that an ICommand implementation is now available and replaces the RibbonCommand as a more MVVM friendly implementation.

However, I haven't been able to databind the viewmodel command (as a prism DelegateCommand in my case) to the view, as I would do for standard buttons.

Here is basically what I'm looking for :

In the ViewModel :

public ICommand NavigateCommand { get { return new DelegateCommand<String>(NavigateExecute); } }

void NavigateExecute(String param)
{
        // do whatever you want
}

In XAML :

<ribbon:RibbonButton Command="{Binding NavigateCommand}" CommandParameter="1"/>

The command is however never triggered. Any hint would be most welcome.


Solution

  • I don't if this will help in your case, but after I moved to the new release ribbon I made all ICommand properties static and that worked. Of course this means your command methods have to be static also.

    Give it a try and let us know.