The model Visual Studio uses for the Application class is essentially the same as the
model it uses for the windows. The starting point is a XAML template, which is named Application.
xaml by default. Here??™s what it looks like (without the resources section, which you??™ll
learn about in Chapter 11):
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml"
>
CHAPTER 3 n THE APPLICATION 60
As you might remember from Chapter 2, the Class attribute is used in XAML to create a
class derived from the element. Thus, this markup creates a class that derives from
System.Windows.Application, with (confusingly enough) the name Application. If you want,
you can change the class name to something else.
The Application tag not only creates a custom application class, but it also sets the
StartupUri property to identify the XAML document that represents the main window. As a
result, you don??™t need to explicitly instantiate this window using code??”the XAML parser will
do it for you.
As with windows, the application class is defined in two separate portions that are fused
together at compile time. The automatically generated portion isn??™t visible in your project, but
it contains the Main() entry point and the code for starting the application.
Pages:
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172