WPF 和大视图的 MEF UserControl 部分(在设计模式下)

发布于 2024-09-26 12:43:15 字数 377 浏览 0 评论 0原文

我希望通过 MEF 创建此用户控件,但也希望在 Blend 中定位用户控件并在其上设置属性...当我对用户控件有“具体”引用时,如何强制组合用户控件所需的导入?

PartsInitializer.Satisfy 发生了什么?

导出用户控件

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

在包含视图中不导入,因为它是一个具体实例。

谢谢 格雷格

I want this usercontrol to be Created via MEF but also to have 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

初与友歌 2024-10-03 12:43:15

当您拥有如下实例时,您可以强制组合:

  1. 导入命名空间 System.ComponentModel.Composition (以包含扩展方法 SatisfyImportsOnce
  2. 创建一个 CompositionContainer
  3. 在组合容器上调用 SatisfyImportsOnce 并为其提供用户控件的实例。

注意,
马丁

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

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