Working with XAML
Extensible Application Markup Language, or XAML (pronounced "zammel"), is an XML-based markup language developed by Microsoft. XAML is the language behind the visual presentation of an application that you develop in Microsoft Expression Blend, just as HTML is the language behind the visual presentation of a web page. Creating an application in Expression Blend means writing XAML code, either by hand or visually by working in the Design view of Expression Blend.
Note
You do not have to understand XAML to create applications in Expression Blend if you work in Design view. For more information, see "Editing XAML by using Design view in Expression Blend" in Editing XAML.
XAML as the equalizer between design applications
You can export art assets from Microsoft Expression Design as XAML, and then import the XAML into your Expression Blend project. Some other design applications have tools that can convert art assets to XAML. You can search the Internet for conversion tools that are posted on trusted sites.
For more information about importing XAML, see Import XAML that is exported from Expression Design.
You can also import Microsoft Silverlight projects that are created by using a Silverlight template to encode a video project in Microsoft Expression Encoder. Additionally, you can modify the Silverlight templates that come with Expression Encoder in Expression Blend.
For more information, see Customize an Expression Encoder template for Silverlight.
XAML, Windows Presentation Foundation, and Microsoft .NET Framework
XAML is part of Windows Presentation Foundation (WPF). WPF is the category of features in the Microsoft .NET Framework that deal with the visual presentation of Windows-based applications and web browser–based client applications.
WPF-based applications can run on Windows Vista or Windows 7, or on earlier versions of Windows if Microsoft .NET Framework (and Internet Explorer 7.0 in the case of web browser–based client applications) is installed.
For more information about the requirements of WPF applications, see Deploy and publish Expression Blend applications.
WPF uses XAML for constructing visually stunning user interfaces (UI) in markup instead of in a programming language such as C#. You can create elaborate UI documents entirely in XAML by defining elements such as controls, text, images, shapes, animation, and more. Because XAML is declarative (like HTML), it requires the addition of code if you want to add run-time logic to your application. For example, if your application uses only XAML, you can create and animate UI elements, and configure them to respond in a limited way to user input (by using event triggers), but your application cannot perform and respond to calculations or spontaneously create new UI elements without the addition of code. The code for a XAML application is stored in a separate file from the XAML document. This separation of UI design from the underlying code enables developers and designers to work more closely together on the same project without delaying each other's progress.
For information about how Expression Blend helps you to incorporate code into your XAML application, see Visual design compared to writing XAML and code.
For more information about XAML and WPF, see the XAML Overview on MSDN or visit the Windows Developer Center .
What is WPF?
WPF is based on managed code but uses a markup language, Extensible Application Markup Language (XAML), to make building applications easier for designers. XAML-based applications currently support C# and Microsoft Visual Basic .NET. If you write a WPF application entirely in procedural code, you can use any common language runtime (CLR) language.
For more information about WPF, see the Windows Presentation Foundation section on MSDN , or see Learning and community resources.
XAML and Silverlight
In Silverlight projects, XAML is also used to represent the visual presentation of your application.
The relationship between XAML and code-behind files
The XAML for any given document in Expression Blend is stored in a .xaml file. If there is underlying code for your XAML document, that code is stored in a file of the same name, with the additional extension of .cs or .vb. For example, if your XAML document is named Window1.xaml, the code-behind file will be called Window1.xaml.cs if the programming language of the code is C#.
For information about how to create XAML documents with or without code-behind files, see Create a new project.
When you build your project, the WPF parser reads the .xaml files for that project and reports any resulting errors. Likewise, when you open an existing project in Expression Blend, the XAML parser reads the .xaml files that are included in your project folder and attempts to parse the elements and display the documents on the artboard in Design view. In both cases, if the parser encounters errors, the artboard is disabled, and Expression Blend displays an error message with a link to open XAML view so that you can resolve the errors. The parsing errors are also reported on the Errors tab in the Results panel.
For more information, see the following topics:
For information about the syntax of individual controls, see Control Library or search for XAML elements in the Class Library reference, both on MSDN.
Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.