WPF和WinForms在同一项目中 [英] WPF and WinForms in same projects
问题描述
我看到了wpf的功能,例如内容丰富的模型,带有图片的工具提示,文本块,数据模板,列表框中的图像,文本框验证,注释,不同的屏幕分辨率都没有问题等. />
有了wpf的这些功能,我想在现有的应用程序中使用它(我无法完全转换为wpf的现有应用程序,因为它主要与硬件和设备相关,并且还使用了第三方组件,dll等).
但是我发现我的应用程序中有一些Winfoms,如果我可以将这些形式转换为WPF形式,那么它将使应用程序真正美丽和用户友好.
基本上,这就是为什么我要使用wpf的原因,并且如上所述,由于某些限制,我无法完成wpf中的应用程序.
最后,我希望获得一些专家的评论和评论,以便我能够完成我的项目.
我可以将基础保留为WPF,然后尝试将现有的不兼容winforms"(取决于第三方组件)添加到wpf应用程序中.
请建议这种混音听起来很聪明,或者可能导致某些性能问题.
I seen the features of a wpf such as rich-content model, tool tips with pictures, text block, data templates, images in list boxes, text box validations, annotations, no problem with different screen- resolutions etc .
With these power of wpf, i want to use it in existing application (i can''t complete convert the existing application in wpf because mostly it is h/w and devices related, and also used 3rd party components, dlls etc. ).
But i find out some winfoms in my applications, if i can convert these forms in wpf forms then it will make the application really beautifull and user friendly.
Basically, that is the reason why i want to use wpf and as i mentioned i can''t complete application in wpf due to certains limitations.
Finally, i want some expert review and comments, so that i can procced my projects.
Can i keep the base as WPF and then try to add the existing ''incompatible winforms'' (which are dependent on 3rd party components ) to wpf application.
Please, suggest that this mixup sounds intelligent or can lead to some performance issue.
推荐答案
您可以使用ElementHost [ ^ ].选中此 [此 [^ ]看看如何完成.
请注意,当将ElementHost添加到Form中时,Visual Studio会自动将一些WPF程序集引用到您的项目中.
You can add custom WPF Controls using the ElementHost[^] found in your ToolBox under ''WPF Interoperability''. Check this[^] and this[^] to see how that is done.
Note that when you add an ElementHost to your Form Visual Studio automatically references some WPF assemblies to your project.
这篇关于WPF和WinForms在同一项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!