WPF WinForms应用程序,在那里把应用程序资源中使用? [英] WPF used within a WinForms application, where to put Application resources?

查看:112
本文介绍了WPF WinForms应用程序,在那里把应用程序资源中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们在的WinForms 的应用承载了许多的 WPF 的控制。该应用程序使用启动 System.Windows.Forms.Application.Run(...)方法的 WPF 的控制使用主办的 ElementHost的

At present we host a number of WPF controls in a WinForms application. The application is started using the System.Windows.Forms.Application.Run(...) method and WPF controls hosted using the ElementHost.

在一个正常的 WPF 的应用我会定义一个 System.Windows.Application 对象(的App.xaml ),并在其上调用运行。通常情况下任何应用程序级别的 WPF 的资源会去那里。我们没有这个。

In a normal WPF application I'd define a System.Windows.Application object (App.xaml) and call run on it. Normally any application level WPF resources would go in there. We don't have this.

我如何指定应用程序级别的资源,为的 WPF 的控制,但仍然可以运行为的的WinForms 的应用程序?

How can I specify application level resources for the WPF controls but still run as a WinForms app?

推荐答案

在托管环境中,你不容易接触到的应用程序,WPF博士有几个// drwpf:在 HTTP在托管方案中的工作方法.COM /博客/ 2007/10/05 /管理应用程序资源,当-WPF的是托管/

In a hosted environment you do not have easy access to the Application, Dr WPF has a couple of methods for working in a hosted scenario at http://drwpf.com/blog/2007/10/05/managing-application-resources-when-wpf-is-hosted/.

我个人用他在工作中,项目SharedResources类,VB6形式托管的WinForms用户控件主机托管ElementHost的用户控件WPF与应用广泛的主题,为WPF控件。

I am personally using his SharedResources class in a work project, VB6 Form hosting Winforms UserControl hosting ElementHost hosting WPF UserControl with a Application wide theme, for the WPF controls.

这篇关于WPF WinForms应用程序,在那里把应用程序资源中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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