托管在WindowsForms项目中使用UnityBootStrapper棱镜的应用程序棱镜、应用程序、项目、WindowsForms

2023-09-04 03:41:49 作者:白云不回头

如何在WindowsForms项目中使用UnityBootStrapper举办一个WPF棱镜的应用程序?

How to host a WPF Prism app using UnityBootStrapper in a WindowsForms project?

我添加引用低于Windows的WPF组件构成主体项目

I have added references to below wpf assemblies in the Windows forms host project

PresentationCore 
PresentationFramework 
WindowsBase Ayatem.xaml 
WindowsFormsIntegration.dll 
Microsoft.Practices.Prism.UnityExtensions

和我已经删除了棱镜项目的App.xaml文件。 在ElementHost控件的胜利方式,​​我想填充的外壳,但是,它不会加载该模块。

And I have deleted the app.xaml file of Prism project. In the ElementHost control of win forms, I am trying to populate shell but, it doesn't load the module.

//Create the ElementHost control for hosting the WPF UserControl
ElementHost host = new ElementHost();
host.Dock = DockStyle.Fill;

//Create the WPF UserControl.
HelloWorld.Shell uc = new HelloWorld.Shell();

//Assign the WPF UserControl to the ElementHost control's Child property.
host.Child = uc;

//Add the ElementHost control to the form's collection of child controls.
this.Controls.Add(host);

我使用了hello world示例棱镜应用程序,并从今天起,我的项目只有1个模块。

I am using the hello world sample prism application and as of today, my project has only 1 module.

推荐答案

下面的的 codePLEX的的的讨论解决了一个非常类似的情况给一个你会尝试完成:

The following Codeplex's discussion resolves a quite similar scenario to the one you would try to accomplish:

PRISM4在Windows窗体环境

请注意,您将需要修改的的 ReionManager的IsInDesignMode()的在 Prism.Desktop 项目为修复已实施的方法当使用一个已知问题的苹果酒的。你只需要改变方法,重建棱镜库并引用新建组件到您的的的WinForm 的解决方案。

Notice that you would need to modify the ReionManager's IsInDesignMode() method from the Prism.Desktop project as a fix has been implemented for a known issue when using Cider. You would just need to change the method, rebuild the Prism Library and reference the newly built assemblies into your WinForm solution.

我希望这有助于, 问候。

I hope this helped, Regards.

 
精彩推荐
图片推荐