c# - Catel 框架 - 替换 View

标签 c# wpf mvvm catel

我正在构建具有多个模块的应用程序。每个模块都包含一个 View 模型和 View 。

我想创建解决方案,以便在我的应用程序的一部分中自动显示 SelectedModule。

假设我有这样的 MainWindow View :

<catel:UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:catel="http://catel.codeplex.com" xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"
    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
    x:Class="OrchestraCatel.Views.MainWindow">

  <DockPanel LastChildFill="True">
    <ContentControl x:Name="Ribbon" DockPanel.Dock="Top">
<!--      My Ribbon-->
    </ContentControl>
    <ContentControl x:Name="MainView" DockPanel.Dock="Top">
<!--      My Main Page-->
    </ContentControl>
  </DockPanel>
</catel:UserControl>

我想显示在 MainView 内的另一个 DLL 中指定的 UserControl功能区项目单击后的 ContentControl。

Ribbon Button 和 MainView View 都在模块 DLL 中

我有一个想法,包括 SelectedViewModel在我的MainPage ViewModel,然后为每个 ViewModel 创建 DataTemplates,但是这个解决方案会打破我对 Modules 的看法,它应该是独立的。

Catel 有没有办法用另一个 View 替换 View ?从任何地方?

最佳答案

我认为 Prism 为您解决了这个问题。请看一下 Prism 与 Catel 的集成:

https://catelproject.atlassian.net/wiki/display/CTL/Catel.Extensions.Prism

关于c# - Catel 框架 - 替换 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30406539/

相关文章:

c# - 从列表中获取不同计数

wpf - wpf mvvm中组合框的选择更改事件

reactjs - 如何在Reactjs中实现类似MVVM的框架

ios - 如何移动逻辑以显示 UITableViewRowAction 从委托(delegate)方法到 View 模型(MVVM 架构)

c# - 用于调试集合的 GridView ?

c# - 无法反序列化当前的 JSON 对象

c# - 系统参数异常 : 'Value' property was already registered by 'Point'

mvvm - PerformanceProgressBar "Invalid cross-thread access"异常

C# 将 Excel 图表作为对象(而不是图片)导出到 Word

c# - WPF数据网格按所选列自动排序