学习WPF时,您发现最难理解的内容 [英] What did you find hardest to understand when learning WPF

查看:200
本文介绍了学习WPF时,您发现最难理解的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您使用了多少WPF


  • 最难理解

  • 或最长被误解了

以及您最终如何理解(请提供链接等)。

and how did you understand it in the end (please provide links etc).

(我要这是为了指导我学习WPF)

推荐答案

很抱歉,这个时间太长了……希望对您有所帮助!我要提到的一件事是,这些是让我绊倒的概念/事物,如果您刚刚起步,我不确定是否将其用作学习内容的逐项列出。我会深入研究书籍,并阅读许多博客(< a href = http://joshsmithonwpf.wordpress.com/ rel = noreferrer>乔什·史密斯, WPF博士),一般来说,请在小项目中尝试一下。

Sorry this got so long ... hopefully it is helpful! One thing I would mention is that these are the concepts/things that tripped me up, I'm not sure if I would use it as an itemized list of what to study if you are just starting out. I would dive in on some books, read through a lot of blogs (Josh Smith, Dr. WPF), and just in general, dive in and try things out in little projects.

核心概念


  • 逻辑树和可视树(链接: 1

了解WPF中的不同树。特别是,要了解逻辑树与可视树,以及如何通过数据模板,控制模板等将逻辑树中的元素扩展为可视树。

Understanding the different trees in WPF. In particular, understanding the logical tree versus the visual tree and how elements in the logical tree gets expanded into the visual tree by way of data templates, control templates, etc.

依赖项属性系统(链接: 1 2

The Dependency Property System (links: 1, 2)

理解WPF中的整个依赖属性系统比它最初看起来要大得多。当然,创建一个快速的依赖属性很容易,然后使用它来授权其他WPF概念,例如数据绑定和动画,但是随后它就开始了。

Understanding the whole dependency property system in WPF is much bigger than it first looks. Sure, it is easy to create a quick dependency property and then use it to empower other WPF concepts like data binding and animation, but then it begins.

有正常的依赖关系属性,然后附加了依赖项属性。有很多不同的方法可以注册它们,还可以设置许多不同的元数据选项。

There are normal dependency properties and then there are attached dependency properties. There are a bunch of different ways to register them all and a bunch of different metadata options that you can set.

了解为什么将其称为依赖项属性,花了我一些时间。也就是说,了解财产的价值来自许多不同的来源(财产取决于这些价值提供者),并且在任何给定时间设定最终财产的价值都有一个优先顺序/算法。

Understanding why it is called a dependency property, for that matter, took me some time. That is, understanding that the value of property comes from many different sources (the property depends on these value providers) and that there is an order of precedence/algorithm for how the final property value at any given time gets set.

路由事件(链接: 1 2

了解它们如何冒泡,路由或定向。了解您还可以附加已路由的事件(与仅将事件处理程序附加到已路由到可视树的事件相比)。

Understanding how they can be bubbling, routing, or direct. Understanding that you can also have attached routed events (versus just attaching an event handler to an event that has routed up the visual tree).

提示

Adam Nathan的 WPF Unleashed 中的第3章是一个很棒的章节,涵盖了这些重要的新概念,您应该阅读其中的内容,并在项目,然后再次阅读。

Chapter 3 in Adam Nathan's WPF Unleashed is an awesome chapter that covers these important new concepts and one that you should read, work on a project, and then read again.

博士。 WPF的代码段是了解路由的依赖项属性的好方法事件和命令。

Dr. WPF's snippets are a great way to learn about dependency properties, routed events, and commands.

图形概念(链接: 1


  • 解决方案独立性(链接: 1 2

WPF带来了所有好处重新构造独立性(您使用设备独立像素指定所有内容),但这也带来了一些需要解决的麻烦。最值得注意的是,通过利用像素捕捉,设置准则等,使事情在需要时看起来更加清晰。

WPF brings all the benefits of resoultion independence (you specify everything with device indepenent pixels) but this also brings some headaches that you need to solve. Most notably, is getting things to look sharp when you want them to by taking advantage of pixel snapping, by setting guidelines, etc.

保留模式与即时模式模式

Retained Mode vs. Immediate Mode

WPF具有保留的模式绘制子系统,这意味着它可以跟踪绘制指令并将其缓存以备后用。如果您尝试构建的东西具有大量的视觉效果,这些视觉效果可以一次更新。这可能是性能问题。

WPF has a retained mode drawing subsystem, meaning that it keeps track of the drawing instructions and caches them for later use. This can be a performance problem if you are trying to build something that has a lot of visuals that are all updating at once.

控件,元素,视觉效果(链接: 1

Controls, Elements, Visuals (links: 1)

了解WPF层次结构中的每件事对您有什么作用,并了解它对性能的影响。尤其是,您使用的控件可以重新模板化,重新设置样式等等……还是需要一些超轻便的东西(例如针对Visual层进行编程),以便可以快速,便捷地驱动它。

Understanding what each thing in the WPF hierarchy does for you and understanding the weight it brings in performance. In particular, do you use a Control that you can retemplate, restyle, and more ... or do you need something ultra-light (like programing against the Visual layer) so that you can drive it hard and fast.

提示

Chris Sells和Ian Griffiths在他们的编程WPF本书,其中讨论了WPF API中的不同类型,它们在层次结构中的位置以及它们带来的价值。

Chris Sells and Ian Griffiths have a great appendix at the back of their Programming WPF book that talks about the different types in the WPF API, where they fit in the hierarchy, and what value they bring.

WPF模式


  • Model-View-ViewModel(MVVM) )模式(链接: 1

已经提到了MVVM模式可以帮助人们以WPF方式开始工作。我不能同意。而不是用数据填充控件,而是开始通过数据模板将数据转换为可视化图像。

The MVVM pattern has already been mentioned as helping one to start doing things the WPF way. I can't agree more. Instead of filling controls with data, you start transforming data into visuals (through data templates).

附加属性行为模式(链接: 1 2 3

Attached Property Behavior Pattern (links: 1, 2, 3)

WPF像其他API一样可扩展。利用附加的属性,您可以以一种非常优雅的方式在您认为自己可能被卡住的地方建立其他行为。

WPF is extensible like no other API. Utilizing attached properties, you can build in additional behavior in a very elegant manner and where you thought you might have been stuck.

WPF!= Windows窗体

我知道有人已经提到了这一点,但我想强调一下。有许多新的和不同的概念,您确实必须学习很多东西,并从完全不同的角度来解决问题。例如,Windows窗体是即时模式绘制子系统,而WPF是保留模式(上图)。

I know someone already mentioned this but I want to agree emphatically. There are so many new and different concepts, you really do have to unlearn quite a few things and approach solving problems from a completely different angle. As an example, Windows Forms is an immediate mode drawing subsystem while WPF is a retained mode one (above).

WPF

这是一件很有趣的事情,但是由于WPF中有很多方法可以做某事,所以几乎瘫痪了。哪种方法是正确的方法?是这个吗是那个吗?我不得不克服对用错误的方式做事的恐惧,只是跳进去,从错误中学习。

This is a funny thing to bring up, but because there is so many ways to do something in WPF, it is almost paralyzing. Which way is the right way to do things? Is it this? Is it that? I have had to get over a fear of doing it the wrong way, to just jump in, and learn from my mistakes.

这篇关于学习WPF时,您发现最难理解的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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