Prev | Current Page 118 | Next

Matthew MacDonald

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


By now, you should have a basic understanding of how to interpret a XAML document
that defines a window and how that XAML document is converted into a final compiled class
(with the addition of any code you??™ve written). In the next section, you??™ll look at the property
syntax in more detail and learn to wire up event handlers.
CHAPTER 2 n XAML 31
Properties and Events in XAML
So far, you??™ve considered a relatively unexciting example??”a blank window that hosts an
empty Grid control. Before going any further, it??™s worth introducing a more realistic window
that includes several controls. Figure 2-1 shows an example with an automatic question
answerer.
Figure 2-1. Ask the eight ball and all will be revealed.
The eight ball window includes four controls: a Grid (the most common tool for arranging
layout in WPF), two TextBox objects, and a Button. The markup that??™s required to arrange and
configure these controls is significantly longer than the previous examples. Here??™s an abbreviated
listing that replaces some of the details with an ellipsis (??¦) to expose the overall
structure:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Eight Ball Answer" Height="328" Width="412">



Pages:
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130