简体   繁体   English

如何将Winform应用程序更改为WPF应用程序?

[英]How to change a Winform application into a WPF application?

I do have a Winform solution with two projects. 我有两个项目的Winform解决方案。 Now I would like to have a UserControl which I can use in my new WPF application. 现在,我想拥有一个可以在新的WPF应用程序中使用的UserControl。

Question: What is the best and easiest way to create such UserControl? 问题:创建此类UserControl的最佳和最简便方法是什么? Is it better to open a new project from scratch or is there a way to create such UserControl directly from the existing winform solution? 从头开始打开新项目还是更好,还是有办法直接从现有winform解决方案中创建此类UserControl?

You can reuse Winforms controls in WPF and viceversa. 您可以在WPF中重复使用Winforms控件,反之亦然。 But think whether you really need it. 但是,请考虑您是否真的需要它。

WPF provides great support for DataBinding whereas Winforms provides very little support for it. WPF为DataBinding提供了强大的支持,而Winforms对此却很少提供支持。 Patterns to implement UI differs in both technologies, etc. 在两种技术中,实现UI的模式都不同,等等。

Consider reimplementing the UserControl with patterns specific to respective UI technology rather than trying to reuse it in different UI technology. 考虑使用特定于相应UI技术的模式重新实现UserControl,而不是尝试在不同的UI技术中重用它。

If at all you want to reuse it: Here you go. 如果您要重用它, 请继续

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM