自动填充区域行为 + MEF
我正在编写一个新应用程序,它使用 PRISM AutoPopulateRegionBehaviour 自动注册区域内的视图。当我在应用程序启动时注册视图时,这工作正常,但是我尝试使用 MEF DeploymentCatalog 下载新的 XAP 并更新区域,但这似乎不起作用(不显示视图)并在中设置断点区域行为。稍后我将尝试上传一个小片段,但我想预先确定这是否可行,或者我是否需要调用某些内容来强制刷新区域。
谢谢。
I am writing a new application which registers views within regions automatically using the PRISM AutoPopulateRegionBehaviour. This works fine when I register the views at app startup, however I am trying to use the MEF DeploymentCatalog to download a new XAP and update the region however this doesn't appear to be working (no views are displayed) and setting a breakpoint in the region behaviour. I'll try and upload a small snippet later but I wanted to pre-empt whether this should be possible or whether I need to call something to force the regions to refresh.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已排序。问题是 RegisteredViews Import 没有得到满足,原因是我通过接口类型而不是具体类型导入视图模型,即
我重命名为:
[Import]
公共 IABCViewModel ViewModel
{
放
{
this.DataContext = 值;
}
到
:
我认为这是因为我需要为接口注册到具体类型的类型映射(尽管这在 WPF 中不是必需的)。
Sorted. The problem was that the RegisteredViews Import wasn't being satisfied, the reason for this was that I was importing the viewmodel by interface type rather than by concrete type i.e.
I renamed:
[Import]
public IABCViewModel ViewModel
{
set
{
this.DataContext = value;
}
}
to:
I think this is because I need to register a type mapping for the interface to the concrete type (though this wasnt necessary in WPF).