December 03, 2013
Gets the Application object for the current application.
Assembly: System.Windows (in System.Windows.dll)
Application is a singleton that implements the static property to provide shared access to the Application instance for the current application. The singleton pattern ensures that state managed by Application, including shared resources and properties, such as the Host information, is available from a single, shared location.
The following example shows how to get a reference to the current Application by using the property.
Since the property is inherited from the base Application class, the property returns a reference to the base Application object instead of the instance of the class that derives from Application. If you need direct access to the latter, you have to cast the value returned by to the type of the class that derives from Application. This is shown in the following code.