A XAML file can be compiled into a.BAML file, which may be inserted as a resource into a.NET Framework assembly. At run-time, the framework engine extracts the.BAML file from assembly resources, parses it, and creates a corresponding WPF visual tree or workflow. When used in Windows Presentation Foundation, XAML is used to describe visual user interfaces. WPF allows for the definition of both 2D and 3D objects, rotations, animations, and a variety of other effects and features. When used in Windows Workflow Foundation contexts, XAML is used to describe potentially long-running declarative logic, such as those created by process modeling tools and rules systems. The serialization format for workflows was previously called XOML, to differentiate it from UI markup use of XAML, but now they are no longer distinguished. However, the file extension for files containing the workflow markup is still "XOML".
This Windows Presentation Foundation example shows the text "Hello, world!" in the top-level XAML container called Canvas.
The schema may have to be changed to work on your computer. Using a schema that Microsoft recommends, the example can also be
This can be integrated into a Web page if WPF is installed using XBAPs that are compiled applications running in a sandboxed environment hosted within the browser. Another way is to use the Silverlight plugin. The code cannot be included directly in an HTML page; rather it must be loaded into the page via JavaScript. If.NET 3.0 or later is installed, loose XAML files can also be viewed on their own in a compatible Web browser in conjunction with the.NET Framework 3.0, without the need for the Silverlight plugin. Loose XAML files are markup-only files limited to defining the visual content to be rendered. They are not compiled with an application.
XAML Example
The MySilverlight.js file must contain the code that loads the above XAML code under the MySilverlight HTML element. A crucial part of utilizing XAML to its full potential is making appropriate usage of binding, as well as being comfortable with creating your own custom user elements as required, for your specific needs. Binding can be done as follows:
Differences between versions of XAML
There are four Microsoft main implementations of XAML:
The Windows Presentation Foundation version, which is used for the.NET Framework beginning with.NET Framework 3.0
These versions have some differences in the parsing behavior. Additionally, the Silverlight 4 XAML parser is not 100% backward compatible with Silverlight 3 files. Silverlight 3 accepted XAML files may not be accepted or are parsed differently by the Silverlight 4 parser.
Criticism of XAML GUI usage in Silverlight
The European Committee for Interoperable Systems said in 2007 that Microsoft's use of XAML in its Silverlight product aimed to introduce content on the World Wide Web that could only be accessed from the Windows platform. Using a plugin, XAML is viewable in some non-Microsoft browsers on Windows, Linux, and Mac; and Microsoft supported Novell's Silverlight viewer for GNU/Linux called Moonlight. As of January 2010, Moonlight 2 was compatible with Silverlight 2, but development of Moonlight was later discontinued.