Getting Started With WPF
Submitted by smartyP on Wed, 01/14/2009 - 09:40I wrote the following blog entry for my company's intranet a few months back and had been meaning to share it publicly. Hopefully it will be of use to people trying to learn WPF from scratch:
Getting Started with WPF
Books:
WPF Unleashed - When I first went to a microsoft event over a year ago to talk about silverlight and WPF I was told that this book was the best book on the subject. I picked up a copy and let it sit on my shelf until almost a year later - and it was still considered one of the best books on the subject. This book is highly focused on XAML and UI creation in WPF, and is a good basis for learning XAML markup - expect to read a few pages, then play with the XAML, read a few pages, play with more XAML, etc.
Programming WPF - I recently picked up this 800+ page book and now that I am 150~ pages in I can firmly state that this book is worth the read. This book is almost the exact opposite as WPF Unleashed in that it talks very little of XAML, and focuses more on programming with WPF applications. Think of it as if you bought a book on coding WinForms applications - it wouldn't just cover the UI designer in Visual Studio, it would cover the hundreds of other things you need to know to create and distribute a real app. This book goes great with WPF Unleashed as they both cover totally different subjects. I also like that I can read this book for 20-30 pages at a time without doing any playing, instead mostly just trying to learn the technologies that are involved in WPF.
Tools:
Kaxaml - Kaxaml is like XamlPad if you have played with that. It lets you write up loose XAML files and see what they look like real time. It was developed by a member of the Blend team, and the guy who runs nerdplusart.com (a blog worth following). This tool is a must have, and is without a doubt the best way to learn how to code XAML by hand (see tips below).
Expression Blend - This tool is sort of a devil in sheeps clothing. It is a really great application, but much like FrontPage it can be the creator of evil when it comes to XAML. It is worth learning Blend for advanced functionality such as animation, tweaning, paths, and maybe complex gradients, but it should in no way replace the need to know XAML itself. When you get Blend be sure to get the latest version - Expression Blend 2.5 June 2008 Preview, and be sure to check out this blog entry for how to get intellisense in Blend.
Video Resources:
WPF Boot Camp 2008 - There was a 3 day boot camp on WPF put on by IdentityMine (the company the creater of Kaxaml and owner of nertplusart.com works for) and other WPF top dogs earlier this year. This site has all the video footage from this boot camp, and best of all it is all free. When downloading the videos make sure you download the ones with '2MB' in the name if you want the highest quality (although the mp4 ones work pretty well for the iPod Touch as well). You can download these and watch them when your eyes get tired of reading books on WPF, that way you can become a total WPF learning zombie.
Lynda.com Expression Blend Videos - Lynda.com has about 6 hours of video training available for free on using Expression Blend. I would suggest you put these off until after you can write a whole UI and its resource dictionaries by hand in Kaxaml.
WindowsClient.net WPF Videos - WindowsClient.net has a section dedicated to WPF videos, these tend to be pretty short and to the point, and videos are being added about 1-2 per week.
General Tips:
- Learn how to code XAML by hand before you even bother with Expression Blend. A recent interview on hanselman.com between a WPF designer and a WPF developer was very insightful to me. The designer made the point that much as no self-respecting HTML designer would only use generated HTML by Dreamweaver, no self-respecting XAML designer will ever use tools like Expression Blend without tweaking and improving the generated XAML by hand. You should get to know XAML by hand, and then use Blend to speed up the development of more complex features of XAML such as animations, etc. Get Kaxaml and learn the XAML first.
- Being able to reproduce examples does not mean WPF is as easy as it looks. Many quick demos show off the 'wow' factor of Blend and how easy it is to make a Flickr browser for example, but this does not translate easily to a real application which you might need to create. Don't always just do examples in books or video tutorials, take the time to try and create something else on your own and see all the roadblocks you run in to and need to research.
- Practice, Practice, Practice - the only way you are going to learn XAML is to do it. Expect a rather large learning curve, and become best buddies with Kaxaml.
- There are significant changes to the application, window, and command models in WPF - be sure to suppliment learning XAML with learning the new programming techniques that go along with WPF as well - the aforementioned 'Programming WPF' book is essential for learning the real meat of WPF beyond just the XAML markup.
Web Resources:
http://j832.com/bagotricks/ (the WPF bag of tricks contains full source and a demo executable showing off some of the k-rad advanced things you can do in WPF)
http://windowsclient.net
http://www.dotnetkicks.com/ (use the WPF tag)
http://blogs.msdn.com/expression/default.aspx (Expression Blend Team blog)
http://blog.nerdplusart.com/
http://www.hanselman.com/blog/ (use the WPF tag, and read about Baby Smash)
http://www.nibblestutorials.net/
http://robburke.net/
http://www.smartypantscoding.com/
Comments
Roger: First, thank you for
Roger:
First, thank you for the recommendation on the WPF Unleashed by Nathan Adams. I'm part of a users group and we are about to start in a week, the 2010 edition of Adams's book.
Do you still recommend the Programming WPF by Chris Sells to supplement the 2010 WPF Unleased? It's a 2007 edition and hasn't been updated since.
Thanks,
Gay