托管在WindowsForms项目中使用UnityBootStrapper棱镜的应用程序 [英] Hosting a Prism app using UnityBootStrapper in a WindowsForms project

查看:397
本文介绍了托管在WindowsForms项目中使用UnityBootStrapper棱镜的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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:

请注意,您将需要修改的 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.

这篇关于托管在WindowsForms项目中使用UnityBootStrapper棱镜的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆