未找到 RibbonCommand [英] RibbonCommand was not found

查看:89
本文介绍了未找到 RibbonCommand的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到大多数 WPF Ribbon 示例都使用了一些代码,例如

I see the majority of WPF Ribbon examples out there use some code like

xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

我收到此错误...未找到类型 'r:RibbonCommand'.请确认您没有丢失程序集引用并且所有引用的程序集都已构建."

I'm getting this error..."The type 'r:RibbonCommand' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."

使用 VS 2010、.NET 4.0.

Using VS 2010, .NET 4.0.

我想弄清楚如何向功能区添加按钮并在单击时执行代码/命令.

I'm trying to figure out how to add a button to the ribbon and execute code/command when it's clicked.

谢谢.

推荐答案

如果您使用的是新的 Microsoft WPF 功能区,则 RibbonCommand 类型已被删除.Command 属性现在是 ICommand 类型.

If you are using the new Microsoft WPF Ribbon, the RibbonCommand type has been removed. The Command property is now an ICommand type.

要在 RibbonButton 上设置命令,您可以执行以下操作:

To set the command on a RibbonButton, you can do the following:

<ribbon:RibbonButton Command="ApplicationCommands.Copy" />

或使用任何实现 ICommand 的命令.

or use any command that implements ICommand.

这篇关于未找到 RibbonCommand的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆