tags:

views:

32

answers:

2

I've been given the task of coming up to speed, at least at a basic level, with WPF. I'm going through the WPF 4 Unleashed book. The first part of the book is going through XAML.

My questions are these:

  • Do people really design their forms using pure XAML (manually creating XAML code)? The only thing I can think of that might be more tedious than this approach is writing forms in assembler.

  • Are tools like Expression Blend designed to allow you to develop WPF forms the traditional drag/drop way and then create the XAML for you?

Thanks very much.

+8  A: 

Do people really design their forms using pure XAML (manually creating XAML code)?

Yes, many people do. Designers are getting more popular, but understanding the generated XAML is very useful. The trick here isn't to think in Windows Forms terms - if you look at Windows Forms generated code, it's a lot of code to do something very simple - look at how many lines of code is required to place and wire up a button, for example. In WPF, you can do this with a single XAML element, and have a lot more flexibility in the process as you go.

The only thing I can think of that might be more tedious than this approach is writing forms in assembler.

I actually disagree. XAML takes some getting used to, but it's highly descriptive, so you can make a very usable UI in very little time.

Are tools like Expression Blend designed to allow you to develop WPF forms the traditional drag/drop way and then create the XAML for you?

Yes. The Visual Studio 2010 designer does a good job for simple cases - Blend is much more feature rich, however. It especially shines when it comes to doing more elaborate styling - once up to speed in it, you'll find you can customize a UI in Blend in ways you never imagined in Windows Forms, very quickly and easily.

Reed Copsey
A: 

Do people really design their forms using pure XAML (manually creating XAML code)?

Almost invariably. I have yet to use the form designer in VS2010, and I'm not yet fluent enough in Expression Blend that using Blend is faster than hand-editing XAML. I do most of my layout prototyping in Kaxaml.

Once I get the layout more or less functional, I'll move over to Blend to make it look good. I also use Blend for editing control templates.

But I always look at the XAML, even in Blend. (I spend a lot of time fixing Blend-generated XAML - Blend's tendency to position elements by setting their margins is kind of a problem.) If I don't understand the XAML, I don't understand my code.

The only thing I can think of that might be more tedious than this approach is writing forms in assembler.

No need to go that far; just try writing them in C#.

Once you're fluent in XAML, it's far faster to develop UI elements by editing markup than it is by screwing around with tools that may or may not produce the XAML that you want. It takes a while to get there, but I'd never go back.

Robert Rossney