开发者

WPF & MEF UserControl part of a larger view (In design mode)

I want this usercontrol to be Created via MEF but also to ha开发者_开发百科ve the usercontrol positioned and properties set on it in Blend... How can I force the composition of the imports that the usercontrol requires when I have a 'Concrete' reference to the usercontrol ?

What happended to PartsInitializer.Satisfy ?

Export for the UserControl

    [Export(typeof(IWOFlyOutFilterMenuView))]
public partial class FlyoutTab_WOsViewFilter : UserControl,IWOFlyOutFilterMenuView,IPartImportsSatisfiedNotification

No Imports in the Containing view as it is a concrete instance.

Thanks Greg


You can force the composition when you have an instance like this:

  1. Import the namespace System.ComponentModel.Composition (to include the extension method SatisfyImportsOnce
  2. Create a CompositionContainer
  3. Call SatisfyImportsOnce on the composition Container and supply it the instance of the usercontrol.

Take care, Martin

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜