Day: December 9, 2007

Get into WPF – Part 1

Wouldn’t it be great if you could create a nice WCF Services demo, and everyone loved it?

Well, that is the problem.. I wanted a spartan interface because I wanted to show off the services and NOT the UI.

Nevertheless after to showing to a few people, I realised that the ‘plain’ Windows Forms client actually put people off. An attractive UI, although irrelevant to my goal of showing a services demo, actually has the effect of making people more interested.

Hence I wanted something to look good, and I thought I would give WPF a shot. As a learning curve, it was actually pretty easy to get into, especially if you are used to putting together ASP.NET web pages.

The important thing is creating a good XAML structure, which is given equal prominence to the GUI design window. I’m sure VB developers will hate this, but frankly the source to me is a great deal cleaner than the way it used to be done. In the past, if I made a mistake in the generated Visual C++ MFC or the C# Win-Forms code, quite often it would be easier to throw the form away and start from scratch.

Anyway I’m lazy… I could spend a week going through WPF tutorials, or I could dive right in. I discovered that Infragistics have a free Grid control for WPF:

And that Derek Harmon had a good example program about how to configure some controls inside it:

It took me about an hour to be a WPF data grid designer 🙂

Later this week I’ll show the steps required to make the Infragistics Datagrid with custom controls