如何将您从WFA(Windows窗体应用程序)转换为WPF应用程序?

问题描述:

HI ...

我在Windows窗体模式下使用VC#,我必须给我的项目一些美感。我曾经听过WPF,这可以帮助我将我的项目转换为另外一种更加重要的风格和形式。



我该如何改造这个项目?

HI...
I''m working with VC# in windows forms mode, and I have to give to my project some beauty. I had listened for WPF this can help me to transform my project to an other more inportance in the style and form.

How can I do to transform this project?

如果您的Winforms应用程序是使用严格的MVP强制执行的,那么您可以在一定程度上重用模型并查看类。 WPF的等价物是MVVM模型。



您可以做的另一种方法是从Winforms部分移植到WPF,并通过多个步骤执行完整端口。 Interop在两者之间工作 - WPF可以托管Winforms控件,Winforms可以托管WPF控件。因此,对于一些迭代,您将拥有一个应用程序,它是两者的混合体。一旦将所有内容移植完毕,就可以删除Winforms程序集。



这将是一种明智而实用的方法,特别适用于大型应用程序。
If your Winforms app was written with strict MVP enforcement, you may be able to reuse your model and view classes to an extent. WPF''s equivalent would be the MVVM model.

An alternateive you can do is to partially port over from Winforms to WPF, and do the full port in multiple steps. Interop works both ways between the two - WPF can host Winforms controls and Winforms can host WPF controls. So for a few iterations you will have an app that''s a hybrid of the two. Once you''ve ported everything over, you can then remove the Winforms assemblies.

That would be a sensible and practical approach, specially for a large application.


您需要转换整个应用程序 - 用手 - 到WPF。没有转换实用程序。 WinForms和WPF是如此不同,你甚至不得不考虑一个不同的线程模型。有效的数据绑定几乎要求您修改所有集合及其代表的对象。



这不是一项简单的任务,如果你只是试图增加美感,我的建议是你抵制这种不重要和无功能的冲动。
You need to convert the entire application - BY HAND - to WPF. There is no conversion utility. WinForms and WPF are so different that you even have to consider a different threading model. And effective databinding almost requires that you modify all of your collections and the objects they represent.

It''s not a trivial task, and if you''re just trying to "add beauty", my suggestion is that you resist the urge for such an unimportant and non-functional reason.


我们使用了一个实用工具。

它可以将您的VB.net表单转换为WPF。
we have used a utility to do.
It can convert your VB.net forms to WPF.