What is .baml file and what's the use of this file? Who creates this file?
4 Answers
A compiled XAML file.
A XAML file can be compiled into a .baml (Binary XAML) 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.

- 5,252
- 2
- 26
- 27
-
11Key thing here is that it is essentially a compression technique - the XAML is still parsed and constructed by the runtime – Gordon Mackie JoanMiro Mar 13 '09 at 22:20
-
1what are the advantages of compiling it into a baml and by that what are the advantages of using assembly resources instead of having keeping it as a file – eran otzap Feb 11 '14 at 13:33
-
1@eranotzap performance. Catch more here: http://blogs.microsoft.co.il/tomershamam/2007/05/25/compiled-xaml-baml-not-il/ – nawfal Apr 28 '16 at 13:30
BAML form is an optimized form of XAML used by the WPF XAML implementation. It is optimized in the sense that it uses internal lookups and tokens for commonly used types or members. The optimization is useful as an implementation detail that addresses packaging size and load time for WPF application scenarios that involve XAML. Full Topic on Msdn

- 33,478
- 39
- 162
- 233
The purpose of BAML is only for checking if generated WPF controls have right values in their properties. Compiled XAML has also its auto-generated *.cs code. You can look at in your app\DEBUG\OBJ directory. Every XAML file has generated cs. Its name is XAMLfileName.g.cs where g means generated.
-
1baml is a file format. It has nothing to do with whether or not the property values are correct. They are not checked until the xaml reader attempts to create the object tree. – Greg Gum Jul 27 '13 at 16:15