Application Class

Encapsulates a Avalonia application.

Definition

Namespace: Avalonia
Assembly: Avalonia.Controls (in Avalonia.Controls.dll) Version: 11.3.999
public class Application : AvaloniaObject, 
	IDataContextProvider, IGlobalDataTemplates, IDataTemplateHost, IGlobalStyles, IStyleHost, 
	IThemeVariantHost, IResourceHost, IResourceNode, IApplicationPlatformEvents, IOptionalFeatureProvider
Inheritance
Object    AvaloniaObject    Application
Implements
IGlobalDataTemplates, IResourceHost, IResourceNode, IDataTemplateHost, IDataContextProvider, IApplicationPlatformEvents, IOptionalFeatureProvider, IGlobalStyles, IStyleHost, IThemeVariantHost

Remarks

The Application class encapsulates Avalonia application-specific functionality, including: - A global set of DataTemplates. - A global set of Styles. - A FocusManager. - An InputManager. - Registers services needed by the rest of Avalonia in the RegisterServices method. - Tracks the lifetime of the application.

Constructors

Application Creates an instance of the Application class.

Properties

ActualThemeVariant 
ApplicationLifetime Application lifetime, use it for things like setting the main window and exiting the app from code Currently supported lifetimes are: - IClassicDesktopStyleApplicationLifetime - ISingleViewApplicationLifetime - IControlledApplicationLifetime - IActivatableApplicationLifetime
Current Gets the current instance of the Application class.
DataContext Gets or sets the Applications's data context.
DataTemplates Gets or sets the application's global data templates.
InheritanceParent
(Inherited from AvaloniaObject)
Item
(Inherited from AvaloniaObject)
Item
(Inherited from AvaloniaObject)
Name Application name to be used for various platform-specific purposes
PlatformSettings Represents a contract for accessing global platform-specific settings.
RequestedThemeVariant Gets or sets the UI theme variant that is used by the control (and its child elements) for resource determination. The UI theme you specify with ThemeVariant can override the app-level ThemeVariant.
Resources Gets the application's global resource dictionary.
Styles Gets the application's global styles.

Methods

Bind(AvaloniaProperty, IBinding)
(Inherited from AvaloniaObject)
Bind(AvaloniaProperty, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableBindingValueUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableObject)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableBindingValueUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
CheckAccess
(Inherited from AvaloniaObject)
ClearValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
ClearValue``1(AvaloniaPropertyUMP)
(Inherited from AvaloniaObject)
ClearValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
ClearValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
CoerceValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
Equals(Object)
(Inherited from AvaloniaObject)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetBaseValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
GetHashCode
(Inherited from AvaloniaObject)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
GetValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
GetValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
Initialize Initializes the application by loading XAML etc.
IsAnimating(AvaloniaProperty)
(Inherited from AvaloniaObject)
IsSet(AvaloniaProperty)
(Inherited from AvaloniaObject)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnFrameworkInitializationCompleted 
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
(Overrides AvaloniaObject.OnPropertyChanged(AvaloniaPropertyChangedEventArgs))
OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
(Inherited from AvaloniaObject)
RaisePropertyChanged``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
RegisterServices Register's the services needed by Avalonia.
SetAndRaise``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
SetCurrentValue(AvaloniaProperty, Object)
(Inherited from AvaloniaObject)
SetCurrentValue``1(StyledPropertyUMP, UMP)
(Inherited from AvaloniaObject)
SetValue(AvaloniaProperty, Object, BindingPriority)
(Inherited from AvaloniaObject)
SetValue``1(DirectPropertyBaseUMP, UMP)
(Inherited from AvaloniaObject)
SetValue``1(StyledPropertyUMP, UMP, BindingPriority)
(Inherited from AvaloniaObject)
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryGetFeature(Type) Queries for an optional feature.
TryGetResource(Object, ThemeVariant, Object) 
UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception)
(Inherited from AvaloniaObject)
VerifyAccess
(Inherited from AvaloniaObject)

Events

ActualThemeVariantChanged 
PropertyChanged
(Inherited from AvaloniaObject)
ResourcesChanged 
UrlsOpenedObsolete.

Fields

Extension Methods

Run(CancellationToken) On desktop-style platforms runs the application's main loop with custom CancellationToken without setting a lifetime.
(Defined by DesktopApplicationExtensions)
Run(ICloseable) On desktop-style platforms runs the application's main loop until closable is closed
(Defined by DesktopApplicationExtensions)
Run(Window) On desktop-style platforms runs the application's main loop until main window is closed
(Defined by DesktopApplicationExtensions)
RunWithMainWindowTWindow
(Defined by DesktopApplicationExtensions)

See Also