从Windows窗体过渡到WPF [英] Transitioning from Windows Forms to WPF

查看:148
本文介绍了从Windows窗体过渡到WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在很长一段时间以来,我一直在坚持使用Windows窗体开发(开始用VB6,并通过对C#.NET 4.5的延续),我有pretty多打一下Windows窗体可以做到的极限,无论是使用纯.NET,并与本地code的特殊效果。

For a long time now, I have been stuck with Windows Forms development (started with VB6, and has continued through to C# .NET 4.5), and I have pretty much hit the limit of what Windows Forms can do, both using pure .NET, and special effects with Native Code.

我知道WPF是未来(现在),和Windows Forms正在放缓成为德precated技术。

I know that WPF is the future (for now), and Windows Forms is slowing becoming a deprecated technology.

我曾试图学习WPF和XAML的,但我在WPF的新任设计师卡住正确的...这真的似乎很难相较于Windows窗体设计使用......当然......这仅仅是一个学习曲线,在某些时候我打算去上一门课程来学习WPF正常。

I have tried to learn WPF and XAML, but I get stuck right at WPF's new designer...It really seems very difficult to use in comparison to the Windows Forms designer...of course...this is just a learning curve, and at some point I plan to go on a course to learn WPF properly.

在此期间,我想知道是否有任何替代.NET的WPF设计,这更适合于Windows窗体开发?

In the meantime, I want to know if there are any alternatives to .NET's WPF designer, that are more suited to Windows Forms developers?

推荐答案

我喜欢在博客上写下了WPF初学者的文章,并有特别一些,可以帮助您解决:

I like to blog about beginner articles for WPF, and there are a few in particular that may help you out:

  • Understanding the change in mindset when switching from WinForms to WPF
  • What is this "DataContext" you speak of?
  • A Simple MVVM Example

要总结,WinForms和WPF之间最大的区别是,在WPF数据层(的DataContext )为您的应用程序,而在的WinForms你的UI层是应用程序

To summarize, the biggest difference between Winforms and WPF is that in WPF your data layer (the DataContext) is your application, while in Winforms your UI layer is your application.

要看看它的另一种方式,与WPF应用程序由您创建的对象,并使用模板和其他用户界面对象来告诉WPF如何绘制你的应用程序组件。

To look at it another way, with WPF your application consists of the objects you create, and you use Templates and other UI objects to tell WPF how to draw your application components.

这就是你建立你的应用程序进行UI对象,然后用所需要的数据提供给他们的WinForms是相反的。

That's the opposite of WinForms where you build your application out of UI objects, and then supply them with the data needed.

由于此,设计师实际上没什么用那么多,因为你的应用程序组件在code设计的,只需要设计师绘制一个友好的用户界面,反映了你的数据类(一般模式的ViewModels

Because of this, the designer isn't actually used that much since your application components are designed in code, and the designer is only needed to draw a user-friendly interface that reflects your data classes (typically Models and ViewModels)

和个人来说,我preFER手动输入我的XAML出来,因为它的速度更快,不会使尽可能多的一塌糊涂的拖/放WPF设计呢,虽然我使用有时设计方preVIEW我的用户界面将是什么样子。

And personally, I prefer to type all my XAML out by hand since it's faster and doesn't make as much of a mess as the drag/drop WPF designer does, although I do use the Designer on occasion to preview what my UI will look like.

因此​​,为了你的答案你一下,如果有适合的WinForms开发其他WPF设计问题,我会建议,而不是找另一名设计师,而不是看学习如何在它的意思的使用方式使用WPF。使用WPF像它的WinForms意味着你的很多东西,使得它如此巨大错过了:)

So to your answer your question about if there's other WPF designers suited for WinForms developers, I would suggest that instead of looking for another designer, instead look to learn how to use WPF in the way it's meant to be used. Using WPF like it's WinForms means you miss out on much of what makes it so great :)

这篇关于从Windows窗体过渡到WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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