Sunday, January 9, 2011

WPF : a new strategy

So I gave up WPF a year ago, and went back to the basic business programming :-) Even at work I do not do any WPF anymore.
This was very successful, but now I got a problem : business programming is all done and fast, but the WPF side still needs work. Having a bad feeling, I started learning WPF, again.. .

But for some reason I stumbled on a great resource, I did not find a year ago : WPF MVVM Video by Jason Dolinger. Now I find this a must see video for anyone starting WPF or MVVM! It is 1 hour, but it tackles almost everything for WPF - MVVM programming. No fancy UI stuff, but data handling! It is a simple application, but Jason takes it through an entire re-factoring cycle :
° starting the win-form way (like most people tend to do when first doing WPF)
° introducing a basic view-model
° a view-model with commands
° adding tests to the view-model
° introducing unity
° ...

This resource really helped me a lot more than the other stuff I found in the past. And now I can search for more specific items if it needs be, since I now know how WPF data handling works. Jason just uses the basic WPF stuff, not 3rd party libs like prism or so, giving you an idea of to start from scratch and what benefits certain frameworks can provide.

Since we're a VB.Net shop, I converted the example to VB.Net what also took a lot of time and effort. There are items in C# that do not have a VB.Net counterpart, or are named differently, for example the yield operator. I only converted the WPF application to VB.Net, and not the dataprovider project, as this is not touched in the video at all. Every big part in the video has its own subfolder and solution, so you can easily see what is changed in what part. I hope you find this conversion useful.

Another reason I looked again at WPF is CCNet vNext, I'm playing with the idea to make the new cctray in wpf, this will give it a new, modern look. And with a bit of luck, we can make the dashbord in silverlight, so we should be able to use the same view-models for cctray and the dashboard!

The source of Jasons video and the conversion.