Over the weekend I was working on some WPF code and getting feelings of being back at basics because I was editing XAML by hand. This was mainly because the designer for VS.NET 2005 is slightly lacking in features but I have this feeling that I'm going to stick with the text editor even when I can drag and drop without any worries of strange things happening.
The thing is that unlike Windows Forms, or especially Win32 dialogs, WPF really is straight forwards to write as text. Win32 dialogs were the closest, but they were a pain to do by hand and so we got dialog designers. Forms under .NET are made up of code, and so a designer we a necessity. Now that I don't have a usable designer I find myself not missing it.
The thing is that WPF is very hard to map to a designer, and although I haven't tried running the Orcas CTPs yet to see how they do it I can't see that a designer will actually be any easier. Take the <Grid> for instance, it's the nearest thing I can think to for needing a designer but it's still very easy to use by hand as the most annoying part is telling the child controls which row and column they belong in. Putting a stack panel on a button so that it can contain a picture and text is doable on a designer, but it'll be easier to make sure that the layout is correct at the XML level. As a bonus writing XAML directly means that I get to know the library better, which is always a good thing.
I'm not sure I'd want to do too much animation this way, but swishing controls off to the side as they're hidden isn't too nasty to do and I'm guessing that visual studio isn't going to go too far down that route anyway and leave it up to
Expression Blend. I tried using that for my UI by the way, but it was a bit much for just dialog design. It's also going to be too expensive for what it does and not part of my MSDN subscription so I don't want to get attached to it if I can't justify buying it.
For now I'll be happy editing XAML directly. I'm working on a fun little toy application that has to deal with lots of pictures and a database so it's quite fun seeing how easy something like displaying a grid of pictures with various rotations and effects has turned out to be compared to what I'd have to do using windows forms. Databinding is also a lot nicer, but the database side hasn't changed in .NET 3 so I'll have to wait for 3.5 before I can use LINQ and make the code truly nice to write. When's that out again, all these SqlCommands really aren't nice to write or use.
Technorati Tags: LINQ, WPF
posted @ Monday, February 12, 2007 3:16 PM