In the previous example,
that means that as soon as you close the Window element with the tag, you
end the document. No more content can follow.
Looking at the start tag for the Window element you??™ll find several interesting attributes,
including a class name and two XML namespaces (described in the following sections). You??™ll
also find the three properties shown here:
4 Title="Window1" Height="300" Width="300">
Each attribute corresponds to a separate property of the Window class. All in all, this tells
WPF to create a window with the caption Window1 and to make it 300 by 300 units large.
nNote As you learned in Chapter 1, WPF uses a relative measurement system that isn??™t what most
Windows developers expect. Rather than letting you set sizes using physical pixels, WPF uses deviceindependent
units that can scale to fit different monitor resolutions and are defined as 1/96 of an inch.
That means the 300-by-300-unit window in the previous example will be rendered as a 300-by-300-pixel
window if your system DPI setting is the standard 96 dpi. However, on a system with a higher system DPI,
more pixels will be used. Chapter 1 has the full story.
XAML Namespaces
Clearly, it??™s not enough to supply just a class name. The XAML parser also needs to know the
.NET namespace where this class is located.
Pages:
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122