WPF 中的 Visual Studio 风格撤消/重做按钮
我想制作一个功能区撤消/重做按钮,其外观和功能类似于 Visual Studio 的撤消/重做按钮。 我一直在尝试使用 RibbonSplitButton 来模仿该行为,但事实证明它只接受其 Items 属性内的菜单项。 有人知道如何解决这个问题吗? 提前致谢。
ps 最坏的情况是编写一个自定义控件来覆盖现有的分割按钮,但有人知道要覆盖什么吗?
I want to make a Ribbon Undo/Redo Button that looks and functions like Visual Studio's Undo/Redo Buttons.
I've been trying to use RibbonSplitButton to mimic the behavior, but it turns out it only accepts menuitems inside its Items Property.
Does anybody have an idea on how to go about this?
Thanks in Advance.
p.s. worst case scenario would be writing a custom control to override the existing splitbutton but does anybody know what to override?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您可以使用 ItemsSource 属性等绑定到它,只允许 MenuItems 应该不是问题。您的应用程序只需要一个撤消和重做命令堆栈,这些命令应该提供撤消/重做方法和 UI 友好的显示字符串。然后可以将这些堆栈绑定到列表,并希望 DataTemplated 显示显示字符串并在单击时调用正确的方法。
It should not be a problem that only MenuItems are allowed as long as you can bind to it using an ItemsSource property or the like. Your application just needs a Undo and Redo stack of commands which should be provide methods for Undo/Redo and a UI friendly display string. These stacks can then be bound to the list and hopefully DataTemplated to show the display string and call the right methods upon click.