Monday, February 27, 2012

Building a WPF User Control: Part 1 - Getting Started

I've been eager to try working with WPF.  Most of my application development experience has centered around web applications.  Desktop apps have always seemed very difficult and time-consuming to develop anything advanced, and with so many limitations on the design.  WPF seems to have adopted some of the best principles from web application development and hammered them in to work at the desktop level.  All the new concepts introduced seem daunting at first until it all clicks.  XAML brings in the HTML strengths; helping you keep your visual logic separate and easy to share with designers using other tools.  Dependency properties help make the flexible XAML possible and eliminate more reasons for needing to write code to handle your UI.  Styles are obvious - drill down to an element anywhere in the visual tree and change something about it and see the difference right away, again with no code.  Routed events are also obvious, event bubbling is core to web development.  With all these 'new' concepts, WPF has made windows development a lot more interesting.

My first 'learning' project is going to be doing the one thing you absolutely cannot and will never be able to do in web applications - the local folder tree.  I know it's been done and I should probably name it 'Yet Another...' whatever, but I want to create one of my own that I can reuse in other projects and with the added feature allowing the intuitive selection of a set of paths (which may make this project at least a little unique).

I'm going to build this project iteratively, with a blog post following each iteration as my publicly shared notes on WPF development.

Goals for Part 1:

  • Create a reusable control project.
  • Follow the MVVM (Model-View-ViewModel) design pattern.
  • Get the control up and running with a simple tree of drives and folders.
  • Use lazy-loading for performance.