Prev | Current Page 152 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

This is the method used by Visual Studio,
and it has several advantages that this chapter has touched on already:
??? Some of the plumbing is automatic. There??™s no need to perform ID lookup with the LogicalTreeHelper
or wire up event handlers in code.
??? Reading BAML at runtime is faster than reading XAML.
??? Deployment is easier. Because BAML is embedded in your assembly as one or more
resources, there??™s no way to lose it.
??? XAML files can be edited in other programs, such as design tools. This opens up the
possibility for better collaboration between programmers and designers. (You also get
this benefit when using uncompiled XAML, as described in the previous section.)
Visual Studio uses a two-stage compilation process when you??™re compiling a WPF application.
The first step is to compile the XAML files into BAML using the xamlc.exe compiler.
CHAPTER 2 n XAML 54
For example, if your project includes a file name Window1.xaml, the compiler will create a
temporary file named Window1.baml and place it in the obj\Debug subfolder (in your project
folder). At the same time, a partial class is created for your window, using the language of your
choice. For example, if you??™re using VB, the compiler will create a file named Window1.g.vb in
the obj\Debug folder. The g stands for generated.


Pages:
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164