#62 – BAML is Compiled XAML

When you create a WPF application, you create a definition of the user interface in XAML, rather than in code.  This separates the definition of the structure of the user interface from its behavior.  The XAML is then parsed at runtime and used to create all of the objects that it describes.

Because XAML is rather verbose, it could be costly/slow to read and parse it at runtime.  Because of this, Visual Studio compiles all XAML into a binary version of the same information.  This is stored as a BAML (Binary Application Markup Language) file.

The resulting BAML file is stored as a resource with your .DLL or .EXE.  Because it is binary, it takes up less space.  It’s also quicker to read at runtime, because it has already been parsed and converted into tokens.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

2 Responses to #62 – BAML is Compiled XAML

  1. Pingback: #86 – The Class Attribute Points to Your Code-Behind « 2,000 Things You Should Know About WPF

  2. Robert says:

    So how can I access compiled XAML (or BAML) when creating WPF controls at runtime? I want to create these controls with XAML that has already been compiled as BAML because that way the XAML will be accessible to Expression Blend

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: