With the release of Beta1 for Silverlight 2 you get two new templates in Visual Studio 2008 for creating Silverlight projects in C# or VB.
Download links to Microsoft Silverlight Tools Beta 1 for Visual Studio 2008 you will find at numerous places on blogs and also in a previous post of mine.
Available Silverlight 2 project templates with Beta 1:
- Silverlight Application
- Silverlight Class Library
When you create a Silverlight Application project and choose to automatically create the test web application site as well, you will get this structure:
Page.xaml and Page.xaml.cs
The default base UserControl (UI) of a new Silverlight application.
App.xaml file and its code-behind "App.xaml.cs"
This is the file in which you can store application wide resources like styling, brushes, etc. The code-behind file offers the ability to add event handling for the application startup, exit and unhandled exception handling.
You will see that the Application_Startup event is already implemented and this is where your default base control gets initiated. Suppose you want to have another control that the Page.xaml default one as the startup control of your application this is where you would be able to change this.
As the name implies, this event is called upon exiting the application.
By default this event is already implemented for you in the App class. This is where you can catch and handle all unhandled exceptions from your application meaning anything that is not handled by a try/catch block. Note however that there are some types of exceptions that will not revert to this event such as stack overflow, access violation, etc.
The AppManifest.xml file defines the assemblies that get deployed in the client application.