Prev | Current Page 146 | Next

Matthew MacDonald

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


As a result, it??™s quite possible to create a WPF application that doesn??™t use the faintest bit of
XAML.
Altogether, there are three distinct coding styles that you can use to create a WPF
application:
CHAPTER 2 n XAML 49
??? Code-only. This is the traditional approach used in Visual Studio for Windows Forms
applications. It generates a user interface through code statements.
??? Code and uncompiled markup (XAML). This is a specialized approach that makes
sense in certain scenarios where you need highly dynamic user interfaces. You load part
of the user interface from a XAML file at runtime using the XamlReader class from the
System.Windows.Markup namespace.
??? Code and compiled markup (BAML). This is the preferred approach for WPF, and the
one that Visual Studio supports. You create a XAML template for each window and this
XAML is compiled into BAML and embedded in the final assembly. At runtime the
compiled BAML is extracted and used to regenerate the user interface.
In the following sections, you??™ll dig deeper into these three models and how they actually
work.
Code-Only
Code-only development is a less common (but still fully supported) avenue for writing a WPF
application without any XAML. The obvious disadvantage to code-only development is that it
has the potential to be extremely tedious.


Pages:
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158