Application Constructor

Initializes a new instance of the Application class.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public Application()

If your application class is implemented entirely using code, you must register a handler with the Startup event in the constructor. You can optionally register handlers with the other Application class events in the constructor, including Exit and UnhandledException.

If your application class is implemented using markup and code-behind, you should register your events in markup and call InitializeComponent from the constructor to ensure that your events are hooked up, and any properties you set in markup are applied.

The following code shows the minimum application class implementation in markup and code-behind that calls InitializeComponent.

<Application xmlns=""


using System.Windows; // Application

namespace SilverlightApplication
    public partial class App : Application
        public App()
            // Initialize custom properties and events.

            // Merge application class markup implementation with 
            // this object.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions