Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
1 out of 4 rated this helpful - Rate this topic

Application.Current Property

Gets the Application object for the current application.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
public static Application Current { get; }

Property Value

Type: System.Windows.Application
The Application object for the current application.

Application is a singleton that implements the static Current 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 Current property.


// Get a reference to the Application base class instance
Application currentApplication = Application.Current;


Since the Current property is inherited from the base Application class, the Current 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 Current to the type of the class that derives from Application. This is shown in the following code.

Run this sample


// Get a reference to the instance of the class that 
// derives from Application
App currentApp = (App)Application.Current;


Silverlight

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.