Sunday, October 22, 2006

What is XAML?

I've been digging in deep to Windows Presentation Framework for a while now. It is an incredible programming model, so I am going to be posting about it whenever I can.

So, what is XAML? XAML is the new XML-based declarative language and part of .Net 3.0. If you haven't already read about it, it is used to declare WPF objects, properties, and event handlers using XML elements and attributes. The objects and properties we define in our XAML map directly to WPF objects and properties. Since XAML is XML, and since the nature of XML is hierarchical (only allows 1 top element) XAML is ideal for defining UI and layout. When a WPF application is compiled, the XAML is parsed and an object tree is created and initialized for each window (ig: form, page, etc) that is XAML based. We can then program against it just as we did in Windows Forms development.

The XAML model seperates UI design from programming logic, so when developing applications, the responsibilities of UI design can be delegated to Designers, and programming left to developers. New tools like Microsoft Expression Interactive Designer can be used to create UI in a tool familiar to developers, the output of which is not a graphic, but XAML. That XAML can be imported into our Visual Studio application, and we can wire-up our event handling and business logic just as we always have.

XAML is not part of WPF, rather it is utilized by WPF for defining UI. You can create XAML and run it as a stand alone application if you like. XAML offers a lot of capabilites, and I think this new programming model will prove to be a powerful one. I'll try to post more about it when I can, exploring more of the features of XAML in detail. In the meantime, the Microsoft Windows SDK is a good place to start learning.

No comments: