This posting contains two XAML clip art files you can use when creating your sample WPF applications. The original source format for each of these images is a Flash drawing, but more about that in a later posting.

Washington State Ferry
Raven

At the bottom of this posting, you can find an attached Zip file (clipXart02.zip) that contains the following two XAML files:

   WashingtonStateFerry.xaml
   Raven.xaml

How XAML is used by WPF applications
XAML (Extensible Application Markup Language) is a declarative markup language that defines objects. Using XAML, you can define the UI elements of a WPF application, along with programming logic, such as animations and transforms. Since a XAML file is an XML-based description, you can even use a text editor, such as Notepad, to create or modify a XAML file. However, most XAML files are created as output by design and development tools.

When a XAML file is used as a resource by a WPF Windows application or library, the XAML file is parsed and compiled into an internal format called BAML. BAML is a binary representation of the object hierarchy and properties defined in the source XAML file. The BAML file is pre-tokenized, so that the WPF runtime spends less time loading data, parsing XML, and validating elements, such as property values.

XAML to BAML diagram

When you build a WPF application or library project, a BAML resource file is created for each corresponding XAML resource file in the project. This includes App.xaml, but only if the element <Application.Resources> is defined. The BAML content is then embedded in the the WPF application or library as resources.

You can list the generated BAML files in Visual Studio 2005 by clicking the Show All Files button on the Solution Explorer tool bar, expanding the obj node, and then expanding either the Debug or Release nodes. Viewing a BAML file is not helpful, since the content is in an internal binary format.

VS Solution Explore

Here are the resulting file sizes of the Ferry.xaml, Ferry.baml, and Ferry_Windows_App.exe files:

Files sizes of XAML, BAML, and .exe

In this case, the resulting BAML file is approximately 30% smaller in size than the corresponding XAML file. Not all XAML content will gain this reduction in size. In fact, the Raven.xaml file resulted in virtually no reduction in size to its corresponding BAML file. Note that the size of the executable file, Ferry_Windows_App.exe, reflects the content of all BAML files as embedded resources.

Enjoy,
Lorin


About Us

We are the Windows Presentation Foundation SDK writers and editors.