开发者

Autopopulateregionbehaviour + MEF

I am writing a new application which registers views within regions automatically using the PRISM AutoPopulateRegionBehaviour. This works fine when I registe开发者_运维百科r 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜