Sunday, January 28, 2007

Learning Windows Presentation Foundation

I'm working on a prototype of a touch screen application, and we've chosen Windows Presentation Foundation as the technology of choice to develop it.

I'm sort of leading the programmer’s team, so I figured I should become a referent in the technology, and decided to learn WPF as best as I could. I had no previous experience with flash or any similar graphical programming model.

I downloaded Microsoft Expression Blend (what's the deal with the black theme), the necessary extensions for Visual Studio, and the SDK for Vista. At the beginning I wanted to dive into samples (the complex ones) and code straight away, thinking hey this is just C# and some xml intuitive markup, right?

Well, true, but if you take into account that most "source code" is declared in xaml, meaning is not an imperative programming model you have to grasp, and that this xaml is meant to be edited in IDEs targeted for designers, with a totally different mindset, you'll find that you end up scuba diving in heaps of xaml of samples without advancing much in the learning process.

Ok, this is when I realized that I should start from the beginning (RTFM man) which in this case turned out to be the documentation that comes with the Windows Vista SDK. Starting from XAML Syntax.

After reading and understanding the basic concepts, like: attribute element property syntax, dependency properties, styles, control templates, controls and animations everything became much easier, I stopped feeling like I was struggling with the platform, and development started to flow.

Is like if someone took html and flash altogether, and merged them with a .net object model, which obviously for a .net programmer is basically great, since it can create flash-like user interfaces without leaving the dark side of the force.

In the bright side of WPF is the potential to create much better user interfaces, and user experiences (as they called them now), and the ability to integrate better the work of developers and designers since now both work on a same xaml artifact (talking of this, lack of Blend integration with VSS is an issue).

The downside is maybe the loss of productivity in programmers, the possibilities are greater but so are the costs. I've found myself working directly with xaml most of the time, and xml programming is verbose, plus Blend is still buggy (is ok, it's a beta).

It shouldn't be very difficult to create xhtml to xaml mappings and vice versa, I think there are some implementations out there of this, but I guess the challenge and the profit maybe, lies in the flash to WPF migration.

Wrapping it up, I've developed some samples and I'll be posting them in a WPF & XAML Samples blog I've created. Check it out!

No comments: