tags:

views:

727

answers:

10

I am currently looking into learning WPF and Silverlight. So far I have been developing in Delphi and C# (Winforms). While looking at some books about WPF and watching some introductory videos online, I am getting the impression that this XAML thing is quite a step backwards in terms of efficiency and usability (for the developer). Especially in the online videos, people are happily typing XAML code for creating forms and controls, which I thought was a technique that became mostly obsolete with the arrival of visual form designers etc. long ago. Why would I want to create a button or a grid by typing a textual representation in XAML when using a form designer is so much faster? Why type a color or a font name when it is much faster to choose it from a dropdown list in a property inspector? Are real-world application GUIs really developed by typing XAML?

I am sure I am missing something here, though I can not figure out what ...

+3  A: 

Well, designers tend to use Expression Blend, which is a powerful xaml designer. But yes, I know a lot of developers who edit xaml as text and find it easier than designers.

Marc Gravell
+3  A: 

If you want to use a designer then get Expression Blend.

You are right though there ought to be some rudimentary designer in VS as well.

Silverlight though has come from a different direction, the typical controls is a recent thing in silverlight and its early days yet.

Having said that as developer I actually prefer typing the XAML in much the same way I prefer to type HTML. Designers (and blend is no exception) dump way too much superflous stuff into the markup that I'd rather not be there.

AnthonyWJones
+23  A: 

It's pretty much the same as writing raw HTML manually as opposed to using a WYSIWYG editor: having a much finer control over the outcome, without the need to go through unnecessary loops with the editor.

DrJokepu
+1 Very succinctly put.
AnthonyWJones
A: 

Because it goes better into version control system so other people can change it at the same time without conflicts? Because you can develop whole application in emacs? Because you could write generators and inspectors for this stuff easily? Because it's easy to control how this GUI would look up to the every small detail?

vava
+10  A: 

Are real-world application GUIs really developed by typing XAML?

In a word, Yes. Maybe not many, but it definitely happens.

My experience with visual designers is that they tend to add unnecessary panels, fixed sizes and absolulte positioning while a more flexible, properly scaling layout is desired. For example look at this recent question on stackoverflow

Also if you write custom controls, you often have to do extra work to make them compatible with the visual designers, this extra work is not required if you are able to edit the xaml directly.

Bubblewrap
+9  A: 

I tend to write all my XAML manually because I haven't become proficient in Blend yet. But some of the other developers I work with love using Blend and it is great for setting things up like gradients.

I recommend you download the trial of Blend and give it a try, it works really well with Visual Studio and saves you a lot of time if you learn how to use it.

timothymcgrath
+1  A: 

XAML could be compared with Glade XML, a format for storing GTK+ based GUIs. GTK+, unlike Windows Forms, and like WPF, is actually sensible in that it uses relative positioning. With Windows Forms, absolute positioning becomes a PITA when people start customizing their fonts and your GUI looks like crap with lots of text clipping.

Relative positioning is easy to hand-code, unlike absolute positioning, because you don't need to work out coordinates!

wj32
+2  A: 

Once you understand how to use the different panel structures that are part of WPF, then writing the XAML by hand really is easier than using a designer. I find that I can type the controls into a form much fast than using any designer, and I have more control on how the XAML looks and is laid out.

I only use the designer to occasionally set a property for a control that's already on the form. And I use Blend to do animations, since I haven't got the XAML for that down yet.

Ray
+5  A: 

If you can type XAML, then you understand XAML :) (imho)

The point of knowing how to type it is to know how to debug it, refactor it, and reorganize it. All of these can't be done currently in Expression blend, and for large projects you need all of them.

The other issue raised here is that manually writing XAML gives your more control, is not such a strong point as it is in the case of html. XAML is allot more structured than html and editors like expression blend or others, pretty much give the same XAML you'd write by hand, with few minor exceptions.

Pop Catalin
+1 Type It == Learn It !
Frozenskys
A: 

I type it.

I hate nothing more than the sloppy, non - deterministic and hard to control output of designers, be it HTML, be it XAML.

Basically, if I create a XAML file I do it exactly the way I write every other piece of code.

I start by segmenting the whole thing into a grid, put an exact pixel size on EVERYTHING (except the odd "free floating" space, where I put "*") decide what goes where and then I also add comments and empty lines to structure the XAML.

Also, I reject every XAML not conforming to this standard as "not usable", which has a very good educational effect.

Sloppiness and negligence of best practices are deadly sins and I never tolerated them.

Turing Complete