Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>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 <a href="https://stackoverflow.com/questions/9591/what-wpf-books-would-you-recommend">books</a>, read through a lot of blogs (<a href="http://joshsmithonwpf.wordpress.com/" rel="nofollow noreferrer">Josh Smith</a>, <a href="http://www.drwpf.com/blog/" rel="nofollow noreferrer">Dr. WPF</a>), and just in general, dive in and try things out in little projects.</em></p> <p><strong>Core Concepts</strong></p> <ul> <li><p>The Logical and Visual Trees (links: <a href="http://msdn.microsoft.com/en-us/library/ms753391.aspx" rel="nofollow noreferrer">1</a>)</p> <p>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.</p></li> <li><p>The Dependency Property System (links: <a href="http://msdn.microsoft.com/en-us/library/ms752914.aspx" rel="nofollow noreferrer">1</a>, <a href="http://msdn.microsoft.com/en-us/library/ms749011.aspx" rel="nofollow noreferrer">2</a>)</p> <p>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.</p> <p>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.</p> <p>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.</p></li> <li><p>Routed Events (links: <a href="http://msdn.microsoft.com/en-us/library/ms742806.aspx" rel="nofollow noreferrer">1</a>, <a href="http://msdn.microsoft.com/en-us/library/bb613550.aspx" rel="nofollow noreferrer">2</a>)</p> <p>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).</p> <p><strong>Tips</strong></p> <p>Chapter 3 in Adam Nathan's <em>WPF Unleashed</em> is an awesome chapter that covers these important new concepts and one that you should read, work on a project, and then read again.</p> <p>Dr. WPF's <a href="http://drwpf.com/Blog/Default.aspx?tabid=36&amp;EntryID=22" rel="nofollow noreferrer">snippets</a> are a great way to learn about dependency properties, routed events, and commands.</p></li> </ul> <p><strong>Graphical Concepts</strong> (links: <a href="http://msdn.microsoft.com/en-us/library/ms748373.aspx" rel="nofollow noreferrer">1</a>)</p> <ul> <li><p>Resolution Independence (links: <a href="http://msdn.microsoft.com/en-us/library/aa970908.aspx" rel="nofollow noreferrer">1</a>, <a href="http://www.wpftutorial.net/DrawOnPhysicalDevicePixels.html" rel="nofollow noreferrer">2</a>)</p> <p>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.</p></li> <li><p>Retained Mode vs. Immediate Mode</p> <p>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.</p></li> <li><p>Controls, Elements, Visuals (links: <a href="http://msdn.microsoft.com/en-us/library/ms750441(VS.85).aspx" rel="nofollow noreferrer">1</a>)</p> <p>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.</p> <p><strong>Tips</strong></p> <p>Chris Sells and Ian Griffiths have a great appendix at the back of their <em>Programming WPF book</em> that talks about the different types in the WPF API, where they fit in the hierarchy, and what value they bring.</p></li> </ul> <p><strong>WPF Patterns</strong></p> <ul> <li><p>Model-View-ViewModel (MVVM) Pattern (links: <a href="https://stackoverflow.com/questions/275098/what-applications-could-i-study-to-understand-datamodel-view-viewmodel">1</a>)</p> <p>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).</p></li> <li><p>Attached Property Behavior Pattern (links: <a href="http://blogs.msdn.com/johngossman/archive/2008/05/07/the-attached-behavior-pattern.aspx" rel="nofollow noreferrer">1</a>, <a href="http://blogs.msdn.com/johngossman/archive/2008/05/16/attachedbehavior-pattern-sample.aspx" rel="nofollow noreferrer">2</a>, <a href="http://www.codeproject.com/KB/WPF/AttachedBehaviors.aspx" rel="nofollow noreferrer">3</a>)</p> <p>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.</p></li> </ul> <p><strong>WPF != Windows Forms</strong></p> <p>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).</p> <p><strong>The Many, Many Ways To Do Things in WPF</strong></p> <p>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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload