To try out a loose XAML page, take a .xaml file and make these changes:
??? Remove the Class attribute on the root element.
??? Remove any attributes that attach event handlers (such as the Button.Click attribute).
??? Change the name of the opening and closing tag from Window to Page. Internet
Explorer can only show hosted pages, not stand-alone windows.
You can then double-click your .xaml file to load it up in Internet Explorer. Figure 2-4
shows a converted EightBall.xaml page, which is included with the downloadable code for this
chapter. You can type in the top text box, but because the application lacks the code-behind
file, nothing happens when you click the button. If you want to create a more capable
browser-based application that can include code, you??™ll need to use the techniques described
in Chapter 9.
Figure 2-4. A XAML page in a browser
CHAPTER 2 n XAML 57
The Last Word
In this chapter, you took a tour through a simple XAML file and learned its syntax at the same
time. Here??™s what you saw:
??? You considered key XAML ingredients, such as type converters, markup extensions, and
attached properties.
??? You learned how to wire up a code-behind class that can handle the events raised by
your controls.
??? You considered the compilation process that takes a standard WPF application into a
compiled executable file.
Pages:
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168