开发者

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 :

开发者_如何学JAVA

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜