如何将WPF应用程序转换为Windows窗体应用程序 [英] How to Convert WPF applications into Windows Form Application

查看:81
本文介绍了如何将WPF应用程序转换为Windows窗体应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将WPF应用程序转换为Windows Form Application

解决方案

这不是一个好主意。



但基本上你可以在大多数部分重用你的代码,并且必须重写UI。如果你从演示文稿中分离逻辑,那么你应该已经有了一个业务层,并且改变并不那么困难。



如果你没有,并且有一个所谓的胖客户端,我建议第一步是通过逻辑,数据检索等识别所有内容,并将其移至库组件至少(如果不是单独的层,物流和可更新性更好),一旦完成,你的UI只是呈现和交互,构建UI的过程非常简单。



我敢说,这些年来这个过程通常都是反向的转移到wpf,这通常是建议反对的东西;)

零增值复杂性。



但移动单独锚定的逻辑将使您能够构建另一个UI并在转换阶段轻松维护两个平台。



希望有帮助


<块引用>没有,不是因为WPF和Windows窗体应用程序彼此处理不同的形式。您可能很幸运找到其中一个代码转换器,我已经看到了c#的visual basic等等,而不是WPF到Windows Form的特定代码。 WPF在图形上比较重,因此使用不同的方法来执行代码,它允许更好地设计GUI,而常规的Windows窗体无法执行WPF所能做的事情。但是你的代码仍然可以被执行,但是你必须使用windows窗体物理创建新项目并将你的代码粘贴到上面。


将WPF转换为WinForms并非易事,当然没有自动化方式如果你想回到.net 1.1,你将失去一大堆其他功能,如泛型等,所以它不仅仅是你要改变的UI。


Is there any way to Convert WPF applications into Windows Form Application

解决方案

That's not really a good idea.

But essentially you can reuse your code behind in most parts and will have to rewrite the UI. If you seperated logics from presentation you should already have a business layer and the change is not that difficult.

If you didn't and have a so-called fat client, i would recommend the step one is to identify everything with logics, data retrieval etc and move that to a library assembly at the very least (if not a seperate tier, which for logistics and updateability would be better,) once that is done, your UI is just presenting and interacting and the process of building the UI is pretty straight forward.

I dare say, though, that these years the process is normally in reverse the move to wpf which also, generally is something which is adviced against ;)
Zero value-adding pile of complexity.

But moving the logics to seperate anchoring will enable you to build another UI and easily maintain both platforms in the transcision phase.

hope that helps


No, not really because WPF and Windows Form Application handle their form differently from each other. You may have luck finding one of those Code converters, i have seen visual basic to c# and so on not a specific one for WPF to Windows Form. WPF is heavier on the graphics and therefore uses bit different methods to execute your code, it allows better design of the GUI while your regular windows form is unable to do what WPF can. However your code can still be executed but you have to physically create new project using windows form and paste your code to over.


Converting WPF to WinForms is not trivial, there is certainly no automated way, and if you want to go back to .net 1.1 as well you'll lose a whole load of other features like generics etc, so it's not just the UI you'll be changing.


这篇关于如何将WPF应用程序转换为Windows窗体应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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