Application Class
TOC
Collapse the table of content
Expand the table of content

Application Class

 

Encapsulates a Windows Presentation Foundation (WPF) application.

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


public ref class Application : DispatcherObject, IQueryAmbient

NameDescription
System_CAPS_pubmethodApplication()

Initializes a new instance of the Application class.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticCurrent

Gets the Application object for the current AppDomain.

System_CAPS_pubpropertyDispatcher

Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)

System_CAPS_pubpropertyMainWindow

Gets or sets the main window of the application.

System_CAPS_pubpropertyProperties

Gets a collection of application-scope properties.

System_CAPS_pubpropertySystem_CAPS_staticResourceAssembly

Gets or sets the Assembly that provides the pack uniform resource identifiers (URIs) for resources in a WPF application.

System_CAPS_pubpropertyResources

Gets or sets a collection of application-scope resources, such as styles and brushes.

System_CAPS_pubpropertyShutdownMode

Gets or sets the condition that causes the Shutdown method to be called.

System_CAPS_pubpropertyStartupUri

Gets or sets a UI that is automatically shown when an application starts.

System_CAPS_pubpropertyWindows

Gets the instantiated windows in an application.

NameDescription
System_CAPS_pubmethodCheckAccess()

Determines whether the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFindResource(Object^)

Searches for a user interface (UI) resource, such as a Style or Brush, with the specified key, and throws an exception if the requested resource is not found (see XAML Resources).

System_CAPS_pubmethodSystem_CAPS_staticGetContentStream(Uri^)

Returns a resource stream for a content data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).

System_CAPS_pubmethodSystem_CAPS_staticGetCookie(Uri^)

Retrieves a cookie for the location specified by a Uri.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetRemoteStream(Uri^)

Returns a resource stream for a site-of-origin data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).

System_CAPS_pubmethodSystem_CAPS_staticGetResourceStream(Uri^)

Returns a resource stream for a resource data file that is located at the specified Uri (see WPF Application Resource, Content, and Data Files).

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticLoadComponent(Object^, Uri^)

Loads a XAML file that is located at the specified uniform resource identifier (URI) and converts it to an instance of the object that is specified by the root element of the XAML file.

System_CAPS_pubmethodSystem_CAPS_staticLoadComponent(Uri^)

Loads a XAML file that is located at the specified uniform resource identifier (URI), and converts it to an instance of the object that is specified by the root element of the XAML file.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnActivated(EventArgs^)

Raises the Activated event.

System_CAPS_protmethodOnDeactivated(EventArgs^)

Raises the Deactivated event.

System_CAPS_protmethodOnExit(ExitEventArgs^)

Raises the Exit event.

System_CAPS_protmethodOnFragmentNavigation(FragmentNavigationEventArgs^)

Raises the FragmentNavigation event.

System_CAPS_protmethodOnLoadCompleted(NavigationEventArgs^)

Raises the LoadCompleted event.

System_CAPS_protmethodOnNavigated(NavigationEventArgs^)

Raises the Navigated event.

System_CAPS_protmethodOnNavigating(NavigatingCancelEventArgs^)

Raises the Navigating event.

System_CAPS_protmethodOnNavigationFailed(NavigationFailedEventArgs^)

Raises the NavigationFailed event.

System_CAPS_protmethodOnNavigationProgress(NavigationProgressEventArgs^)

Raises the NavigationProgress event.

System_CAPS_protmethodOnNavigationStopped(NavigationEventArgs^)

Raises the NavigationStopped event.

System_CAPS_protmethodOnSessionEnding(SessionEndingCancelEventArgs^)

Raises the SessionEnding event.

System_CAPS_protmethodOnStartup(StartupEventArgs^)

Raises the Startup event.

System_CAPS_pubmethodRun()

Starts a Windows Presentation Foundation (WPF) application.

System_CAPS_pubmethodRun(Window^)

Starts a Windows Presentation Foundation (WPF) application and opens the specified window.

System_CAPS_pubmethodSystem_CAPS_staticSetCookie(Uri^, String^)

Creates a cookie for the location specified by a Uri.

System_CAPS_pubmethodShutdown()

Shuts down an application.

System_CAPS_pubmethodShutdown(Int32)

Shuts down an application that returns the specified exit code to the operating system.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTryFindResource(Object^)

Searches for the specified resource.

System_CAPS_pubmethodVerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

NameDescription
System_CAPS_pubeventActivated

Occurs when an application becomes the foreground application.

System_CAPS_pubeventDeactivated

Occurs when an application stops being the foreground application.

System_CAPS_pubeventDispatcherUnhandledException

Occurs when an exception is thrown by an application but not handled.

System_CAPS_pubeventExit

Occurs just before an application shuts down, and cannot be canceled.

System_CAPS_pubeventFragmentNavigation

Occurs when a navigator in the application begins navigation to a content fragment, Navigation occurs immediately if the desired fragment is in the current content, or after the source XAML content has been loaded if the desired fragment is in different content.

System_CAPS_pubeventLoadCompleted

Occurs when content that was navigated to by a navigator in the application has been loaded, parsed, and has begun rendering.

System_CAPS_pubeventNavigated

Occurs when the content that is being navigated to by a navigator in the application has been found, although it may not have completed loading.

System_CAPS_pubeventNavigating

Occurs when a new navigation is requested by a navigator in the application.

System_CAPS_pubeventNavigationFailed

Occurs when an error occurs while a navigator in the application is navigating to the requested content.

System_CAPS_pubeventNavigationProgress

Occurs periodically during a download that is being managed by a navigator in the application to provide navigation progress information.

System_CAPS_pubeventNavigationStopped

Occurs when the StopLoading method of a navigator in the application is called, or when a new navigation is requested by a navigator while a current navigation is in progress.

System_CAPS_pubeventSessionEnding

Occurs when the user ends the Windows session by logging off or shutting down the operating system.

System_CAPS_pubeventStartup

Occurs when the Run method of the Application object is called.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIQueryAmbient::IsAmbientPropertyAvailable(String^)

Queries for whether a specified ambient property is available in the current scope.

Application is a class that encapsulates WPF application-specific functionality, including the following:

Application implements the singleton pattern to provide shared access to its window, property, and resource scope services. Consequently, only one instance of the Application class can be created per AppDomain.

You can implement an Application using markup, markup and code-behind, or code. If Application is implemented with markup, whether markup or markup and code-behind, the markup file must be configured as an Microsoft build engine (MSBuild) ApplicationDefinition item.

System_CAPS_noteNote

A standalone application does not require an Application object; it is possible to implement a custom static entry point method (Main) that opens a window without creating an instance of Application. However, XAML browser applications (XBAPs) require an Application object.

The following example shows how a standard application is defined using only markup:

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />

The following example shows how a standard application is defined using only code:

No code example is currently available or this language may not be supported.

The following example shows how a standard application is defined using a combination of markup and code-behind.

<Application 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  x:Class="SDKSample.App" />
No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

The public static (Shared in Visual Basic) members of this type are thread safe. In addition, the FindResource and TryFindResource methods and the Properties and Resources properties are thread safe.

Return to top
Show:
© 2016 Microsoft