自动填充区域行为 + MEF

发布于 2024-11-06 09:54:28 字数 223 浏览 1 评论 0原文

我正在编写一个新应用程序,它使用 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 技术交流群。

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

发布评论

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

评论(1

娇女薄笑 2024-11-13 09:54:28

已排序。问题是 RegisteredViews Import 没有得到满足,原因是我通过接口类型而不是具体类型导入视图模型,即

我重命名为:

[Import]
公共 IABCViewModel ViewModel
{

{
this.DataContext = 值;
}

   public ABCViewModel ViewModel
    {
        set
        {
            this.DataContext = value;
        }
    }

我认为这是因为我需要为接口注册到具体类型的类型映射(尽管这在 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:

   public ABCViewModel ViewModel
    {
        set
        {
            this.DataContext = value;
        }
    }

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).

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