Prev | Current Page 109 | Next

Matthew MacDonald

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


??? You can set the properties of each class through attributes. However, in some situations
an attribute isn??™t powerful enough to handle the job. In these cases, you??™ll use nested
tags with a special syntax.
nTip If you??™re completely new to XML, you??™ll probably find it easier to review the basics before you tackle
XAML. To get up to speed quickly, try the free web-based tutorial at http://www.w3schools.com/xml.
Before continuing, take a look at this bare-bones XAML document, which represents a
new blank window (as created by Visual Studio). The lines have been numbered for easy
reference:
1 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="Window1" Height="300" Width="300">
5
6
7

8

This document includes only two elements??”the top-level Window element, which represents
the entire window, and the Grid, in which you can place all your controls. Although you
could use any top-level element, WPF applications rely on just a few:
??? Window
??? Page (which is similar to Window, but used for navigable applications)
??? Application (which defines application resources and startup settings)
CHAPTER 2 n XAML 27
As in all XML documents, there can only be one top-level element.


Pages:
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121