如何以MVVM方式实现WPF Ribbon Contextual Tabs
我正在使用 Office UI 许可站点中的 WPF Ribbon 控件作为主菜单来开发 MVVM 应用程序。我无法将上下文选项卡绑定或以某种方式注入到我的功能区控件中。我不想在主视图中存储所有上下文选项卡标记和命令绑定,我想根据所选视图使用此选项卡,并将此选项卡存储在同一视图或仅包含此类选项卡的某些特殊视图中。是否可以?
I'm developing MVVM application using WPF Ribbon control from Office UI licensing site as main menu. And I can not bind or somehow inject contextual tabs into my ribbon control. I do not want to store all contextual tabs markup and command bindings in my main view, I want to use this tabs depending on view selected and store this tabs maybe in same view or some special view with only this type of tabs. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的一件事是为 App.config 中的各种
RibbonTab
编写Style
甚至ControlTemplate
,从而避免需要将该标记放入MainWindow
中。然后只需将所有RibbonTab
添加到MainWindow.xaml
中的Ribbon
中并设置Visibility< /code> 每个属性都绑定到主视图模型。您可以通过简单的
bool
到Visibility
转换器在主视图模型中使用一系列bool
属性。One thing you could do is to write
Style
s or evenControlTemplate
s for the variousRibbonTab
s in your App.config, avoiding the need to put that markup in theMainWindow
. Then simply add all theRibbonTab
s into theRibbon
inMainWindow.xaml
and set theVisibility
properties of each by binding to the main view model. You could use a load ofbool
properties in the main view model with a simplebool
toVisibility
converter.