【发布时间】:2020-05-22 16:32:18
【问题描述】:
简单视图是 Dragablz Tab 的子视图,定义如下:
UserControl x:Class="Esc.Eris.Apps.Dashboards.Views.DashboardViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<Grid>
<ContentControl prism:RegionManager.RegionName="DashboardViewerContentRegion" />
</Grid>
</UserControl>
通过在 ViewModel 构造函数中设置断点,我可以检查 IRegionManager regionManager 注入参数的内容,但 regionManager 不包含任何区域。
我以为视图中的 prism:RegionManager.RegionName= 声明自动向 regionManager 注册了区域,但显然不是。
这不是我的第一个 Prism 应用,但这是我第一次看到这种行为。
包含此视图的模块已通过 App.xaml.cs 文件中的 ConfigureModuleCatalog 添加到 moduleCatalog。
有人能解释一下这里发生了什么吗?
提前致谢!
【问题讨论】: