O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generated Source Code

Some procedural code does get generated in the XAML compilation process (if you use x:Class), but it’s just some “glue code” similar to what had to be written to load and parse a loose XAML file at runtime. Such files are given a suffix such as .g.cs and .g.i.cs (or .g.vb and .g.i.vb), where the g stands for generated and the i stands for IntelliSense.

Each generated source file contains a partial class definition for the class specified with x:Class on the root object element. This partial class contains a field (private by default but configurable with x:FieldModifier) for every named element in the XAML file, using the element name as the field name. It also contains an InitializeComponent method that does the grunt work ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required