WPF vs Winforms for。net Newbies

时间:2021-12-08 13:58:35

I'm very new to Microsoft .Net framework My question is: Which is easier and faster to learn Winforms or WPF?

我对微软。net框架非常陌生我的问题是:Winforms和WPF哪一个更容易更快?

9 个解决方案

#1


62  

Easier and faster? Almost certainly winforms.

更容易和更快的吗?几乎肯定winforms。

WPF is tricker to quantify - it is more complex yet more powerful, but to be honest I've lost track of it's future... Is it killed? Who knows... Xaml certainly has life in mobile (WP7), though.

WPF难以量化——它更复杂更强大,但说实话,我已经忘记了它的未来……杀了吗?谁知道……不过,Xaml在移动设备(WP7)方面确实具有生命力。

IMO though, your time is better spent learning web UI - some jQuery or HTML5.

在我看来,你最好花时间学习web UI——一些jQuery或HTML5。

#2


410  

Neither and Both, easy is very subjective and depends on your background. First of all, I want to show an example of an application with the following in both WPF and WinForms:

两者都不是,简单是非常主观的,取决于你的背景。首先,我想展示一个应用程序的示例,它包含了WPF和WinForms:

  • A textbox for input
  • 一个文本框输入
  • A button to do some "Processing" of the input
  • 做输入“处理”的按钮
  • A label that will display a result
  • 显示结果的标签

WinForms

WinForms

The window can look something like this:

窗户可以是这样的:

WPF vs Winforms for。net Newbies

The code for this is quite trivial and easy even for a beginner:

这段代码对于初学者来说是相当琐碎和容易的:

private Button _myButton;
private Label _resultLabel;
private TextBox _inputTextBox;
public Form1()
{
    InitializeComponent();
    _myButton = new Button
    {
        Text = @"Process data",
        Top = 100
    };

    _inputTextBox = new TextBox();

    _resultLabel = new Label
    {
        Text = "",
        Top = 200
    };

    Controls.Add(_myButton);
    Controls.Add(_inputTextBox);
    Controls.Add(_resultLabel);

    _myButton.Click += Process_Click;    
}

void Process_Click(object sender, EventArgs e)
{
    _resultLabel.Text = string.Format("Your data is: {0}", _inputTextBox.Text);
}

So far, we haven't touched anything in the designer.

到目前为止,我们还没有接触到设计师的任何东西。

WPF

WPF

If we copy and paste the exact same code into a new WPF-application, there are just a handful of things that we have to change some of them being:

如果我们复制并粘贴完全相同的代码到一个新的wpf应用程序中,我们只需要改变一些东西:

  • How we add the controls to the interface
  • 如何向接口添加控件
  • How we change text in a label
  • 如何改变标签中的文本
  • How we position it from the top ( margin )
  • 如何从顶部定位(边距)

However, these are just things that is different between the two, it's neither more difficult nor more easy in one or the other. So this is what the window looks like in WPF:

然而,这只是两者之间的不同之处,两者之间既不困难也不容易。这就是WPF中的窗口

WPF vs Winforms for。net Newbies

And the code is almost identical:

代码几乎是一样的:

private Button _myButton;
private Label _resultLabel;
private TextBox _inputTextBox;
public MainWindow()
{
    InitializeComponent();

    _myButton = new Button
    {
        Content = @"Process data",
        Margin = new Thickness(0, 100, 0, 0)
    };
    _myButton.Click += Process_Click;

    _inputTextBox = new TextBox();
    _resultLabel = new Label
    {
        Content = "",
        Margin = new Thickness(0, 100, 0, 0)
    };
    var panel = new StackPanel();
    panel.Children.Add(_inputTextBox);
    panel.Children.Add(_myButton);
    panel.Children.Add(_resultLabel);   
    Content = panel;
}

void Process_Click(object sender, EventArgs e)
{
    _resultLabel.Content = 
                 string.Format("Your data is: {0}", _inputTextBox.Text);
}

So far both WPF and WinForms seem to be equivalently hard / easy to learn. But this is just the code-behind approach, when we come to the designer, there's a huge difference.

到目前为止,WPF和WinForms似乎相当难学。但这只是代码隐藏方法,当我们谈到设计时,有很大的不同。

WinForms

WinForms

When you develop WinForms applications you drag and drop controls onto your surface and use a property window to change the properties of your window. This looks something like this:

当您开发WinForms应用程序时,您可以将控件拖放到surface上,并使用属性窗口来更改窗口的属性。它看起来是这样的:

WPF vs Winforms for。net Newbies

So you can drag-n-drop your controls, you can change the properties of each control and snap them to where you want them, easy enough right?

所以你可以拖拽-n-drop你的控件,你可以改变每个控件的属性然后把它们放到你想要的位置,很简单吧?

WPF

WPF

So what about WPF? Is it much harder to do the same thing there? I think not:

WPF呢?在那里做同样的事情更难吗?我不这样认为:

WPF vs Winforms for。net Newbies

The main difference here is that you have an extra "window" at the bottom. This window is an XML ( XAML ) view of your design. This is where WinForms and WPF differ from each other. But just as you can avoid writing Design Code in WinForms, you can avoid doing it in WPF as well, as a newbie that is.

这里的主要区别是在底部有一个额外的“窗口”。此窗口是设计的XML (XAML)视图。这就是WinForms和WPF的不同之处。但是正如您可以避免使用WinForms编写设计代码一样,您也可以避免使用WPF编写设计代码,就像新手一样。

As for newbies, I don't think it's harder nor easier to learn the one or the other, when we get a bit deeper into the technology that is choosen, sure, it gets more complex. But the way there is just as easy or hard no matter which of the two you choose.

至于新手,我不认为学习其中的一个或另一个会更困难或更容易,当我们深入研究这个技术的时候,当然,它会变得更复杂。但是无论你选择哪一种方法,都是一样的简单或困难。

So when do you choose the one or the other?

你什么时候会选择其中一个呢?

You choose WinForms because:

你选择WinForms是因为:

  • It's been around for a long time and you have a large control supply that you can use.
  • 它已经存在很长一段时间了,你可以使用大量的控制供应。
  • There are a lot of good resources on WinForms to learn from and to get new controls from.
  • WinForms上有很多很好的资源可以学习和获得新的控件。

You choose WPF because:

你选择WPF,因为:

  • You can make richer UI, nowdays it's all about the user experience.
  • 你可以让用户界面更丰富,现在都是用户体验。
  • You want to have full control of your control's design.
  • 你想要完全控制你的控制的设计。
  • You want rich, data-driven applications.
  • 您需要丰富的、数据驱动的应用程序。
  • You want hardware accelerated UI.
  • 需要硬件加速UI。

How about data-binding, Design Patterns and all that?

那么数据绑定、设计模式等等呢?

You don't need to know anything about Design Patterns nor how everything works to make a usable application, especially not as a newbie. As time goes by, you will have to learn more about the technology that you choose. People tend to say that you need to know MVVM to use WPF, that is not true. As it is not true that you need to know the MVP pattern to create WinForms applications.

您不需要了解任何有关设计模式的知识,也不需要了解如何使应用程序变得可用,尤其是作为新手。随着时间的推移,你将不得不更多地了解你所选择的技术。人们倾向于说使用WPF需要了解MVVM,这是不对的。因为创建WinForms应用程序并不需要知道MVP模式。

Both of the technologies can handle rich, data-driven controls; you have grid views and such in both of them. WinForms has some pretty nice "drag-n-drop" features for data manipulation and listing and WPF has very nice data-binding.

这两种技术都可以处理丰富的数据驱动控件;在这两个视图中都有网格视图。WinForms有一些非常好的数据处理和列表的“拖放”特性,WPF有非常好的数据绑定。

What if I don't want to choose one or the other?

如果我不想选择其中一个呢?

The beauty is that you don't have to! You can host WinForms controls in WPF and you can host WPF controls inside WinForms. This means that if you are developing a WinForms application and you want to take advantages of WPF, that's ok you can!

美妙之处在于你不必这么做!您可以在WPF中托管WinForms控件,也可以在WinForms中托管WPF控件。这意味着,如果您正在开发WinForms应用程序,并且希望利用WPF,那么您可以这样做!

So which is easier?

所以哪个更容易?

Neither and both! As a newbie, both can look very similar on the surface, even though it is quite different when you go deeper.

也和这两个!作为一个新手,两者在表面上看起来都很相似,即使当你深入到更深的地方时,它们是完全不同的。

They are similar but so different; the thing is that when you start out, you have other things to think about than how the Routing model works and how to adapt to MVVM.

它们很相似,但又很不同;问题是,当您开始时,除了考虑路由模型如何工作以及如何适应MVVM之外,您还有其他事情要考虑。

Is XAML dead?

XAML死了吗?

No. XAML isn't dead. WP7 uses Silverlight which is also using XAML. Even though a lot of development in the future can be done with HTML5, I doubt that XAML is about to "die". People asked if WinForms was going to die when WPF was released and it hasn't.

不。XAML不是死了。WP7使用Silverlight,也使用XAML。尽管未来很多开发都可以用HTML5来完成,但我怀疑XAML是否会“消亡”。人们问,当WPF被释放时,WinForms是否会死亡,而它没有。

#3


19  

Windows Forms is certainly more of a mature technology than WPF, I would say. There is an ample amount of documentation. I think that the WinForms vs. WPF thing is really absurd, because I think they each have their own use.

我想说,Windows窗体肯定比WPF更成熟。有大量的文档。我认为WinForms和WPF之间的冲突是非常荒谬的,因为我认为它们都有各自的用途。

Windows Forms is good, and you can make very appealing UI with it. WPF vs Winforms for。net Newbies

Windows窗体很好,您可以用它来创建非常吸引人的UI。

But I also think that WinForms is very good for developing Windows Look and Feel Applications where with WPF, you are looking for a more multimedia/rich experience.

但是我也认为WinForms非常适合开发Windows Look和Feel应用程序,在WPF中,您需要更多的多媒体/丰富的体验。

I've developed with WinForms for years now and have yet to adopt WPF, because I still do not have a need for WPF. I can acheive everything I want with WinForms. As a matter of fact I've developed an entire framework based for WinForms to provide a rich, Windows Look and Feel experience, to able to acheive the above shown results with ease.

我已经用WinForms开发了很多年了,现在还没有使用WPF,因为我仍然不需要WPF。我可以用葡萄酒来满足我想要的一切。事实上,我已经为WinForms开发了一个完整的框架,以提供丰富的Windows外观和体验,从而能够轻松地实现上面显示的结果。

However, if I am in the realm of needing to creating a rich multimedia experience, I would switch over to WPF. But I'm in the realm of developing functional applications like tooks, issue tracking software, framework, etc.

但是,如果我需要创建丰富的多媒体体验,我将切换到WPF。但是我正在开发功能应用程序,比如tooks, issue tracking software, framework等等。

As a matter of fact, here is another example of what I have done with WinForms. I feel like I can really push WinForms to the limit, and have the ability to go a step further. I like the development in it.

事实上,这是我用WinForms做的另一个例子。我觉得我可以把WinForms推向极限,并有能力更进一步。我喜欢它的发展。

I think when people try to comapre WinForms to WPF in terms of design, I'm not sure they really get just what good design is. Its more then fancy buttons and animations, and pretty ribbon controls.

我认为,当人们试图在设计方面与WPF进行竞争时,我不确定他们是否真正理解好的设计是什么。它更花哨的按钮和动画,以及漂亮的丝带控件。

I'm not here to dog on either WinForms or WPF though. I think both are great technologies, but I definitely think WPF is more geared towards a rich multimedia style experience.

我来这里不是为了在WinForms和WPF上撒野。我认为这两种技术都很棒,但我绝对认为WPF更适合丰富的多媒体风格体验。

Furthermore, I don't think either one is easier to learn. WPF you dive into a different event style model with XAML, WinForms you dive into doing more of everything yourself. I think of WinForms vs. WPF in a C++/C# perspective, but in the UI sense. WPF seems like a higher level design style with more abstraction, which makes it much easier to design appealing UI. Rather WinForms, you literally have to make your design well by programming it all.

此外,我认为这两个都不容易学。WPF您将使用XAML深入到一个不同的事件样式模型中,并通过winform让您自己完成更多的事情。我认为WinForms和WPF是在c++ / c#的角度上,但在UI的意义上。WPF似乎是一种更高层次的设计风格,具有更多的抽象,这使得设计具有吸引力的UI更加容易。相反,你必须通过编程使你的设计变得更好。

In conclusion (I jumped all over the place), I would try each out and some sample projects, and pick what you like the best, and what meets your specific needs. I don't believe either that just because you have WinForms skills you will be "maintaining code". There are still TONS of things being developed in WinForms today.

综上所述(我跳过了所有的地方),我将尝试每一个和一些样例项目,选择你喜欢的最好的,以及什么满足你的特殊需要。我也不相信仅仅因为你有WinForms技能,你就会“维护代码”。今天仍然有大量的东西正在以WinForms的形式开发。

#4


14  

WinForms is massively easier to learn (as there is very little to learn). It will be very easy to develop RAD applications. On the other hand, WPF will require a lot more effort while your app will be more maintainable (with the help of MVVM paradigm).

WinForms更容易学习(因为几乎没什么可学的)。开发RAD应用程序非常容易。另一方面,WPF将需要更多的努力,而您的应用程序将更易于维护(借助MVVM范例)。

#5


9  

Windows forms, would be easier to learn.

Windows窗体将更容易学习。

View this link for a small writeup on WPF vs Winforms.

查看此链接以获得关于WPF vs Winforms的小记录。

#6


5  

I like to say it this way

我喜欢这么说

Winforms is easier because it is designed the same way as you would have designed it with your current intelligence and experience level given you had enough time to implement it. Therefor you can just pick it up and start using it the way you think things work. I often guess when developing winforms and 90% of the time it just works that way.

Winforms更简单,因为它的设计方式与您在有足够的时间来实现它的情况下使用当前的智能和经验级别进行设计是一样的。因此,你可以把它捡起来,用你认为的方式来使用它。我经常猜想开发winforms的时候,90%的时候都是这样。

WPF on the other hand is over architectured and trying to be way to smart all the time making it a mess to do the medium range complexity things (guess what's the difference between a UserControl and a CustomControl is and when you have to use which). Super simple stuff as drag and drop editor works to attract users and massive weird things like databinding your application template on the fly with a web service takes 2 lines just for showoff. Anything new you do requires you to look things up in documentation/examples.

另一方面,WPF已经超越了架构,并一直试图成为一种聪明的方法,使中等范围的复杂性变得一团糟(猜猜UserControl和CustomControl之间的区别是什么,什么时候你必须使用它们)。超级简单的东西作为拖放编辑器,可以吸引用户和大量奇怪的东西,比如在一个web服务上用一个web服务来绑定你的应用程序模板,只需要两行就可以了。你所做的任何新事情都需要你在文档/示例中查找。

Use winforms to get things done and if you need the performance for anything go with Direct2d, microsoft has a managed wrapper for it in the Windows API Code Pack 1.1.

使用winforms来完成任务,如果需要使用Direct2d的性能,microsoft在Windows API代码包1.1中有一个托管包装。

#7


1  

Winforms is basically easier to learn, in particular if you are coming from VB6

Winforms更容易学习,尤其是如果您来自VB6

WPF is much more powerful in many ways but it has many new concepts (e.g. DataTemplate) that may require a lot of efforts, in particular for beginners.

WPF在很多方面更强大,但是它有许多新概念(例如DataTemplate),这可能需要很多努力,特别是对初学者来说。

When you learn WPF, you usually learn also the MVVM pattern. This is good but at least for me was not easy at the beginning.

当您学习WPF时,通常还会学习MVVM模式。这很好,但至少对我来说,一开始并不容易。

In conclusion, WPF has more new concepts than Winform. You have to learn new things and change your way of thinking. This takes time but I think it's worth it because you can use such concepts for other purposes. For examples what I learned with WPF was useful for Android programming.

总之,WPF比Winform有更多的新概念。你必须学习新的东西,改变你的思维方式。这需要时间,但我认为这是值得的,因为你可以将这些概念用于其他目的。例如,我在WPF中学到的东西对Android编程很有用。

#8


1  

In most cases windows forms would suffice. You can implement almost any confounded ui requirement out of windows forms. The same thing you can get out of wpf.

在大多数情况下,windows窗体就足够了。您可以在windows窗体之外实现几乎所有复杂的ui需求。从wpf中也可以得到同样的结果。

But wpf kind of supports a paradigm called mvvm which separates the UI from the model, and the UI based interactions/validations from both. This makes various aspects of the application independently testable. For e.g. you can take the validation logic, write various test cases around it, and test it independently, without actually disturbing the UI development or the model development.

但是wpf支持一种称为mvvm的范例,它将UI与模型分离开来,并且基于UI的交互/验证与两者都分离。这使得应用程序的各个方面都可以独立地测试。例如,您可以使用验证逻辑,围绕它编写各种测试用例,并独立地测试它,而不会真正干扰UI开发或模型开发。

But this is technically what mvvm offers you? Wpf is a technology that utilizes hardware accelerated graphics, and device indepent pixellation. Meaning your form (as long as it doesn't resize) will look the same on a monitor will lower dpi, or, a higher dpi. (DPI is a measure of pixel density).

但这是mvvm提供给你的技术吗?Wpf是一种利用硬件加速图形和设备像素化的技术。意味着您的表单(只要它不调整大小)在监视器上看起来是一样的,会降低dpi,或者更高的dpi。(DPI是像素密度的度量)。

Catch the article here:

抓住文章:

http://www.codeproject.com/Articles/140611/WPF-Tutorial-Beginning

http://www.codeproject.com/Articles/140611/WPF-Tutorial-Beginning

#9


0  

While winforms is easier to learn as said by others, WPF is the preferred front end framework for .Net enterprise application these days. If you have winform skills you get to maintain apps, WPF skills will get you into new product development.

虽然winforms更容易学习,但是WPF是目前。net企业应用程序首选的前端框架。如果你有维护应用的winform技能,WPF技能会让你进入新的产品开发。

#1


62  

Easier and faster? Almost certainly winforms.

更容易和更快的吗?几乎肯定winforms。

WPF is tricker to quantify - it is more complex yet more powerful, but to be honest I've lost track of it's future... Is it killed? Who knows... Xaml certainly has life in mobile (WP7), though.

WPF难以量化——它更复杂更强大,但说实话,我已经忘记了它的未来……杀了吗?谁知道……不过,Xaml在移动设备(WP7)方面确实具有生命力。

IMO though, your time is better spent learning web UI - some jQuery or HTML5.

在我看来,你最好花时间学习web UI——一些jQuery或HTML5。

#2


410  

Neither and Both, easy is very subjective and depends on your background. First of all, I want to show an example of an application with the following in both WPF and WinForms:

两者都不是,简单是非常主观的,取决于你的背景。首先,我想展示一个应用程序的示例,它包含了WPF和WinForms:

  • A textbox for input
  • 一个文本框输入
  • A button to do some "Processing" of the input
  • 做输入“处理”的按钮
  • A label that will display a result
  • 显示结果的标签

WinForms

WinForms

The window can look something like this:

窗户可以是这样的:

WPF vs Winforms for。net Newbies

The code for this is quite trivial and easy even for a beginner:

这段代码对于初学者来说是相当琐碎和容易的:

private Button _myButton;
private Label _resultLabel;
private TextBox _inputTextBox;
public Form1()
{
    InitializeComponent();
    _myButton = new Button
    {
        Text = @"Process data",
        Top = 100
    };

    _inputTextBox = new TextBox();

    _resultLabel = new Label
    {
        Text = "",
        Top = 200
    };

    Controls.Add(_myButton);
    Controls.Add(_inputTextBox);
    Controls.Add(_resultLabel);

    _myButton.Click += Process_Click;    
}

void Process_Click(object sender, EventArgs e)
{
    _resultLabel.Text = string.Format("Your data is: {0}", _inputTextBox.Text);
}

So far, we haven't touched anything in the designer.

到目前为止,我们还没有接触到设计师的任何东西。

WPF

WPF

If we copy and paste the exact same code into a new WPF-application, there are just a handful of things that we have to change some of them being:

如果我们复制并粘贴完全相同的代码到一个新的wpf应用程序中,我们只需要改变一些东西:

  • How we add the controls to the interface
  • 如何向接口添加控件
  • How we change text in a label
  • 如何改变标签中的文本
  • How we position it from the top ( margin )
  • 如何从顶部定位(边距)

However, these are just things that is different between the two, it's neither more difficult nor more easy in one or the other. So this is what the window looks like in WPF:

然而,这只是两者之间的不同之处,两者之间既不困难也不容易。这就是WPF中的窗口

WPF vs Winforms for。net Newbies

And the code is almost identical:

代码几乎是一样的:

private Button _myButton;
private Label _resultLabel;
private TextBox _inputTextBox;
public MainWindow()
{
    InitializeComponent();

    _myButton = new Button
    {
        Content = @"Process data",
        Margin = new Thickness(0, 100, 0, 0)
    };
    _myButton.Click += Process_Click;

    _inputTextBox = new TextBox();
    _resultLabel = new Label
    {
        Content = "",
        Margin = new Thickness(0, 100, 0, 0)
    };
    var panel = new StackPanel();
    panel.Children.Add(_inputTextBox);
    panel.Children.Add(_myButton);
    panel.Children.Add(_resultLabel);   
    Content = panel;
}

void Process_Click(object sender, EventArgs e)
{
    _resultLabel.Content = 
                 string.Format("Your data is: {0}", _inputTextBox.Text);
}

So far both WPF and WinForms seem to be equivalently hard / easy to learn. But this is just the code-behind approach, when we come to the designer, there's a huge difference.

到目前为止,WPF和WinForms似乎相当难学。但这只是代码隐藏方法,当我们谈到设计时,有很大的不同。

WinForms

WinForms

When you develop WinForms applications you drag and drop controls onto your surface and use a property window to change the properties of your window. This looks something like this:

当您开发WinForms应用程序时,您可以将控件拖放到surface上,并使用属性窗口来更改窗口的属性。它看起来是这样的:

WPF vs Winforms for。net Newbies

So you can drag-n-drop your controls, you can change the properties of each control and snap them to where you want them, easy enough right?

所以你可以拖拽-n-drop你的控件,你可以改变每个控件的属性然后把它们放到你想要的位置,很简单吧?

WPF

WPF

So what about WPF? Is it much harder to do the same thing there? I think not:

WPF呢?在那里做同样的事情更难吗?我不这样认为:

WPF vs Winforms for。net Newbies

The main difference here is that you have an extra "window" at the bottom. This window is an XML ( XAML ) view of your design. This is where WinForms and WPF differ from each other. But just as you can avoid writing Design Code in WinForms, you can avoid doing it in WPF as well, as a newbie that is.

这里的主要区别是在底部有一个额外的“窗口”。此窗口是设计的XML (XAML)视图。这就是WinForms和WPF的不同之处。但是正如您可以避免使用WinForms编写设计代码一样,您也可以避免使用WPF编写设计代码,就像新手一样。

As for newbies, I don't think it's harder nor easier to learn the one or the other, when we get a bit deeper into the technology that is choosen, sure, it gets more complex. But the way there is just as easy or hard no matter which of the two you choose.

至于新手,我不认为学习其中的一个或另一个会更困难或更容易,当我们深入研究这个技术的时候,当然,它会变得更复杂。但是无论你选择哪一种方法,都是一样的简单或困难。

So when do you choose the one or the other?

你什么时候会选择其中一个呢?

You choose WinForms because:

你选择WinForms是因为:

  • It's been around for a long time and you have a large control supply that you can use.
  • 它已经存在很长一段时间了,你可以使用大量的控制供应。
  • There are a lot of good resources on WinForms to learn from and to get new controls from.
  • WinForms上有很多很好的资源可以学习和获得新的控件。

You choose WPF because:

你选择WPF,因为:

  • You can make richer UI, nowdays it's all about the user experience.
  • 你可以让用户界面更丰富,现在都是用户体验。
  • You want to have full control of your control's design.
  • 你想要完全控制你的控制的设计。
  • You want rich, data-driven applications.
  • 您需要丰富的、数据驱动的应用程序。
  • You want hardware accelerated UI.
  • 需要硬件加速UI。

How about data-binding, Design Patterns and all that?

那么数据绑定、设计模式等等呢?

You don't need to know anything about Design Patterns nor how everything works to make a usable application, especially not as a newbie. As time goes by, you will have to learn more about the technology that you choose. People tend to say that you need to know MVVM to use WPF, that is not true. As it is not true that you need to know the MVP pattern to create WinForms applications.

您不需要了解任何有关设计模式的知识,也不需要了解如何使应用程序变得可用,尤其是作为新手。随着时间的推移,你将不得不更多地了解你所选择的技术。人们倾向于说使用WPF需要了解MVVM,这是不对的。因为创建WinForms应用程序并不需要知道MVP模式。

Both of the technologies can handle rich, data-driven controls; you have grid views and such in both of them. WinForms has some pretty nice "drag-n-drop" features for data manipulation and listing and WPF has very nice data-binding.

这两种技术都可以处理丰富的数据驱动控件;在这两个视图中都有网格视图。WinForms有一些非常好的数据处理和列表的“拖放”特性,WPF有非常好的数据绑定。

What if I don't want to choose one or the other?

如果我不想选择其中一个呢?

The beauty is that you don't have to! You can host WinForms controls in WPF and you can host WPF controls inside WinForms. This means that if you are developing a WinForms application and you want to take advantages of WPF, that's ok you can!

美妙之处在于你不必这么做!您可以在WPF中托管WinForms控件,也可以在WinForms中托管WPF控件。这意味着,如果您正在开发WinForms应用程序,并且希望利用WPF,那么您可以这样做!

So which is easier?

所以哪个更容易?

Neither and both! As a newbie, both can look very similar on the surface, even though it is quite different when you go deeper.

也和这两个!作为一个新手,两者在表面上看起来都很相似,即使当你深入到更深的地方时,它们是完全不同的。

They are similar but so different; the thing is that when you start out, you have other things to think about than how the Routing model works and how to adapt to MVVM.

它们很相似,但又很不同;问题是,当您开始时,除了考虑路由模型如何工作以及如何适应MVVM之外,您还有其他事情要考虑。

Is XAML dead?

XAML死了吗?

No. XAML isn't dead. WP7 uses Silverlight which is also using XAML. Even though a lot of development in the future can be done with HTML5, I doubt that XAML is about to "die". People asked if WinForms was going to die when WPF was released and it hasn't.

不。XAML不是死了。WP7使用Silverlight,也使用XAML。尽管未来很多开发都可以用HTML5来完成,但我怀疑XAML是否会“消亡”。人们问,当WPF被释放时,WinForms是否会死亡,而它没有。

#3


19  

Windows Forms is certainly more of a mature technology than WPF, I would say. There is an ample amount of documentation. I think that the WinForms vs. WPF thing is really absurd, because I think they each have their own use.

我想说,Windows窗体肯定比WPF更成熟。有大量的文档。我认为WinForms和WPF之间的冲突是非常荒谬的,因为我认为它们都有各自的用途。

Windows Forms is good, and you can make very appealing UI with it. WPF vs Winforms for。net Newbies

Windows窗体很好,您可以用它来创建非常吸引人的UI。

But I also think that WinForms is very good for developing Windows Look and Feel Applications where with WPF, you are looking for a more multimedia/rich experience.

但是我也认为WinForms非常适合开发Windows Look和Feel应用程序,在WPF中,您需要更多的多媒体/丰富的体验。

I've developed with WinForms for years now and have yet to adopt WPF, because I still do not have a need for WPF. I can acheive everything I want with WinForms. As a matter of fact I've developed an entire framework based for WinForms to provide a rich, Windows Look and Feel experience, to able to acheive the above shown results with ease.

我已经用WinForms开发了很多年了,现在还没有使用WPF,因为我仍然不需要WPF。我可以用葡萄酒来满足我想要的一切。事实上,我已经为WinForms开发了一个完整的框架,以提供丰富的Windows外观和体验,从而能够轻松地实现上面显示的结果。

However, if I am in the realm of needing to creating a rich multimedia experience, I would switch over to WPF. But I'm in the realm of developing functional applications like tooks, issue tracking software, framework, etc.

但是,如果我需要创建丰富的多媒体体验,我将切换到WPF。但是我正在开发功能应用程序,比如tooks, issue tracking software, framework等等。

As a matter of fact, here is another example of what I have done with WinForms. I feel like I can really push WinForms to the limit, and have the ability to go a step further. I like the development in it.

事实上,这是我用WinForms做的另一个例子。我觉得我可以把WinForms推向极限,并有能力更进一步。我喜欢它的发展。

I think when people try to comapre WinForms to WPF in terms of design, I'm not sure they really get just what good design is. Its more then fancy buttons and animations, and pretty ribbon controls.

我认为,当人们试图在设计方面与WPF进行竞争时,我不确定他们是否真正理解好的设计是什么。它更花哨的按钮和动画,以及漂亮的丝带控件。

I'm not here to dog on either WinForms or WPF though. I think both are great technologies, but I definitely think WPF is more geared towards a rich multimedia style experience.

我来这里不是为了在WinForms和WPF上撒野。我认为这两种技术都很棒,但我绝对认为WPF更适合丰富的多媒体风格体验。

Furthermore, I don't think either one is easier to learn. WPF you dive into a different event style model with XAML, WinForms you dive into doing more of everything yourself. I think of WinForms vs. WPF in a C++/C# perspective, but in the UI sense. WPF seems like a higher level design style with more abstraction, which makes it much easier to design appealing UI. Rather WinForms, you literally have to make your design well by programming it all.

此外,我认为这两个都不容易学。WPF您将使用XAML深入到一个不同的事件样式模型中,并通过winform让您自己完成更多的事情。我认为WinForms和WPF是在c++ / c#的角度上,但在UI的意义上。WPF似乎是一种更高层次的设计风格,具有更多的抽象,这使得设计具有吸引力的UI更加容易。相反,你必须通过编程使你的设计变得更好。

In conclusion (I jumped all over the place), I would try each out and some sample projects, and pick what you like the best, and what meets your specific needs. I don't believe either that just because you have WinForms skills you will be "maintaining code". There are still TONS of things being developed in WinForms today.

综上所述(我跳过了所有的地方),我将尝试每一个和一些样例项目,选择你喜欢的最好的,以及什么满足你的特殊需要。我也不相信仅仅因为你有WinForms技能,你就会“维护代码”。今天仍然有大量的东西正在以WinForms的形式开发。

#4


14  

WinForms is massively easier to learn (as there is very little to learn). It will be very easy to develop RAD applications. On the other hand, WPF will require a lot more effort while your app will be more maintainable (with the help of MVVM paradigm).

WinForms更容易学习(因为几乎没什么可学的)。开发RAD应用程序非常容易。另一方面,WPF将需要更多的努力,而您的应用程序将更易于维护(借助MVVM范例)。

#5


9  

Windows forms, would be easier to learn.

Windows窗体将更容易学习。

View this link for a small writeup on WPF vs Winforms.

查看此链接以获得关于WPF vs Winforms的小记录。

#6


5  

I like to say it this way

我喜欢这么说

Winforms is easier because it is designed the same way as you would have designed it with your current intelligence and experience level given you had enough time to implement it. Therefor you can just pick it up and start using it the way you think things work. I often guess when developing winforms and 90% of the time it just works that way.

Winforms更简单,因为它的设计方式与您在有足够的时间来实现它的情况下使用当前的智能和经验级别进行设计是一样的。因此,你可以把它捡起来,用你认为的方式来使用它。我经常猜想开发winforms的时候,90%的时候都是这样。

WPF on the other hand is over architectured and trying to be way to smart all the time making it a mess to do the medium range complexity things (guess what's the difference between a UserControl and a CustomControl is and when you have to use which). Super simple stuff as drag and drop editor works to attract users and massive weird things like databinding your application template on the fly with a web service takes 2 lines just for showoff. Anything new you do requires you to look things up in documentation/examples.

另一方面,WPF已经超越了架构,并一直试图成为一种聪明的方法,使中等范围的复杂性变得一团糟(猜猜UserControl和CustomControl之间的区别是什么,什么时候你必须使用它们)。超级简单的东西作为拖放编辑器,可以吸引用户和大量奇怪的东西,比如在一个web服务上用一个web服务来绑定你的应用程序模板,只需要两行就可以了。你所做的任何新事情都需要你在文档/示例中查找。

Use winforms to get things done and if you need the performance for anything go with Direct2d, microsoft has a managed wrapper for it in the Windows API Code Pack 1.1.

使用winforms来完成任务,如果需要使用Direct2d的性能,microsoft在Windows API代码包1.1中有一个托管包装。

#7


1  

Winforms is basically easier to learn, in particular if you are coming from VB6

Winforms更容易学习,尤其是如果您来自VB6

WPF is much more powerful in many ways but it has many new concepts (e.g. DataTemplate) that may require a lot of efforts, in particular for beginners.

WPF在很多方面更强大,但是它有许多新概念(例如DataTemplate),这可能需要很多努力,特别是对初学者来说。

When you learn WPF, you usually learn also the MVVM pattern. This is good but at least for me was not easy at the beginning.

当您学习WPF时,通常还会学习MVVM模式。这很好,但至少对我来说,一开始并不容易。

In conclusion, WPF has more new concepts than Winform. You have to learn new things and change your way of thinking. This takes time but I think it's worth it because you can use such concepts for other purposes. For examples what I learned with WPF was useful for Android programming.

总之,WPF比Winform有更多的新概念。你必须学习新的东西,改变你的思维方式。这需要时间,但我认为这是值得的,因为你可以将这些概念用于其他目的。例如,我在WPF中学到的东西对Android编程很有用。

#8


1  

In most cases windows forms would suffice. You can implement almost any confounded ui requirement out of windows forms. The same thing you can get out of wpf.

在大多数情况下,windows窗体就足够了。您可以在windows窗体之外实现几乎所有复杂的ui需求。从wpf中也可以得到同样的结果。

But wpf kind of supports a paradigm called mvvm which separates the UI from the model, and the UI based interactions/validations from both. This makes various aspects of the application independently testable. For e.g. you can take the validation logic, write various test cases around it, and test it independently, without actually disturbing the UI development or the model development.

但是wpf支持一种称为mvvm的范例,它将UI与模型分离开来,并且基于UI的交互/验证与两者都分离。这使得应用程序的各个方面都可以独立地测试。例如,您可以使用验证逻辑,围绕它编写各种测试用例,并独立地测试它,而不会真正干扰UI开发或模型开发。

But this is technically what mvvm offers you? Wpf is a technology that utilizes hardware accelerated graphics, and device indepent pixellation. Meaning your form (as long as it doesn't resize) will look the same on a monitor will lower dpi, or, a higher dpi. (DPI is a measure of pixel density).

但这是mvvm提供给你的技术吗?Wpf是一种利用硬件加速图形和设备像素化的技术。意味着您的表单(只要它不调整大小)在监视器上看起来是一样的,会降低dpi,或者更高的dpi。(DPI是像素密度的度量)。

Catch the article here:

抓住文章:

http://www.codeproject.com/Articles/140611/WPF-Tutorial-Beginning

http://www.codeproject.com/Articles/140611/WPF-Tutorial-Beginning

#9


0  

While winforms is easier to learn as said by others, WPF is the preferred front end framework for .Net enterprise application these days. If you have winform skills you get to maintain apps, WPF skills will get you into new product development.

虽然winforms更容易学习,但是WPF是目前。net企业应用程序首选的前端框架。如果你有维护应用的winform技能,WPF技能会让你进入新的产品开发。