使用 MVVM 实现选项卡控制页面 Ribbon Tab

发布于 2024-12-16 01:52:11 字数 344 浏览 4 评论 0原文

我正在创建一个应用程序,它将是一个基于选项卡的应用程序,每个选项卡都有单独的页面。我想使用 RibbonTab 作为选项卡。

选择一个 RibbonTab 时,相应的 UserControl 将加载到下面的部分中。 每个 RibbonTab 和每个 UserControl 的行为应该像一对。

第一个挑战 - 对于每个 RibbonTab-UserControl 对使用单个 ViewModel 会很容易。但是如何将单个 ViewwModel 共享到单独的视图中。

第二个挑战 - 实现此应用程序的最佳方式是什么

一个 Ribbontab 和一个 UserControl 已经准备就绪。等待如何将两者联系起来。

I am creating an Application which will be a Tab based application having separate pages for each Tab. I want use RibbonTab as the Tab.

On selecting one RibbonTab corresponding UserControl will be loaded in the below section.
Each RibbonTab and each UserControl should behave like a pair.

First Challenge - It would be easy to use single ViewModel for each RibbonTab-UserControl pair. But how to share single ViewwModel in to separate view.

Second Challenge - What is best way to implement this application

One Ribbontab and One UserControl is already ready. Waiting for how to associate those two.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷你仙 2024-12-23 01:52:11

我不清楚第一个挑战,请您详细说明一下,我将编辑答案。

至于第二个挑战,我强烈建议选择一个框架,因为这将使实现 MVVM 变得更容易 框架比较

我使用 ContentControl 和 ResourceDictionary 来根据绑定的 ViewModel 确定要显示的视图,如 这个示例。该技术也可用于选项卡控件,这里有一些有关如何实现此功能的链接:

Microsoft 选项卡控制应用程序教程

选项卡控件绑定

I'm not clear on the First challenge could you elaborate it please and I'll edit the answer.

As for the second challenge I highly recomend choosing a framework as that will make implementing MVVM a little easier Framework Comparison

I use a ContentControl and ResourceDictionary to determine what view to display based on the bound ViewModel as in this example. That technique could be used for the tab control as well here are a couple links on how to implement this:

Microsoft Tab Controled application Tutorial

Tab Control Binding

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文