#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