Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
XAML (Extensible Application Markup Language) is the codename for a new Microsoft markup language used to create UI elements for client applications in the forthcoming Windows release codenamed "Longhorn." The main XAML benefit to developers is that you'll be able to separate the application logic code from presentation code. You could have designers building your application UI as a XAML skin separate from the development of the application logic code. XAML is part of Microsoft's overall "Avalon" presentation programming model in Longhorn, so you'll often see references to Avalon and XAML together.
XAML is XML-based and is implemented as an XML schema, and the schema currently is installed when you install Longhorn as xaml.xsd. It is a declarative language, because XAML programs are based on rules and facts to follow, rather than a list of steps to execute. In most cases, however, a XAML program will combine one of the other .NET languages, primarily either Visual Basic .NET or C# (JScript is supported too), using either code behind or markup within the XAML file. XAML uses these other languages to support events and user interaction.
The XAML language isn't complete or final yet, so any examples you see at this point could possibly change. And, the current XAML schema isn't completely valid according to XML schema rules but Microsoft expects that later iterations will be valid. XAML will be supported as a language in the Visual Studio .NET release codenamed Whidbey, giving developers the tool they need to code in XAML in preparation for the Longhorn OS release, providing VS interface features such as IntelliSense to ease XAML coding.
XAML programs are made up for four basic element categories. The four categories are panels, controls, text formatting, and shapes.
Panels control page layout in the UI. They are also containers for other XAML elements. Controls react to user input. Text formatting elements handle the obvious text formatting issues their name implies, but also handle document structure. And lastly, shapes produce vector graphics.
Elements are represented by tags such as:
A tag like this with inner text requires an ending tag as shown.
Elements are arranged hierarchically, with one root element. The parent property is used to access higher elements in the hierarchy. An element deeper in the hierarchy is called a child. Element tags can have attributes, similar to the attribute concept you are familiar with in HTML where the attribute modifies the tag behavior. For instance, if you need to specify the size of that "Hello World" text, you might use an attribute such as:
<Text FontSize="20">Hello World</Text>
So, when can you start tinkering with XAML? Unless you are one of a select crowd of developers who have the early Longhorn preview, not immediately. Longhorn was distributed to the few thousand developers who attended Microsoft's Professional Developer's Conference (PDC) in Los Angeles in October, 2003. Additionally, the Longhorn preview is available to developers who subscribe to Microsoft's MSDN Universal service. If you aren't in that crowd, you'll have to wait a while for Microsoft to announce more plans for a more widely distributed Longhorn beta. In fact, over the last few months (late winter 2004), some Microsoft employees have started hinting the Longhorn release will be delayed even further than was expected at PDC, and many public news stories now point to another interim Windows release prior to Longhorn, much delaying the timeframe when you'll be able to put XAML into action.
If you can't wait for Longhorn to get XAML's separation of code and content, you might want to take a look at Xamlon, a XAML-like set of libraries that works with the current .NET Framework.
For Longhorn and XAML technical details, code samples, and more, a great place to start is the MSDN Longhorn Developer Center.
Jim Minatel is a freelance writer for Developer.com in addition to working with Wiley and WROX publishing.