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:
- Import the namespace System.ComponentModel.Composition (to include the extension method SatisfyImportsOnce
- Create a CompositionContainer
- Call SatisfyImportsOnce on the composition Container and supply it the instance of the usercontrol.
Take care, Martin
精彩评论