Table of Contents

Class AppBuilder

Namespace
Avalonia
Assembly
Avalonia.Controls.dll

Initializes platform-specific services for an Application.

public sealed class AppBuilder
Inheritance
AppBuilder
Inherited Members
Extension Methods

Properties

AfterPlatformServicesSetupCallback

public Action<AppBuilder> AfterPlatformServicesSetupCallback { get; }

Property Value

Action<AppBuilder>

AfterSetupCallback

Gets a method to call after the Application is setup.

public Action<AppBuilder> AfterSetupCallback { get; }

Property Value

Action<AppBuilder>

ApplicationType

Gets the type of the Instance (even if it's not created yet)

public Type? ApplicationType { get; }

Property Value

Type

Instance

Gets the Application instance being initialized.

public Application? Instance { get; }

Property Value

Application

LifetimeOverride

Gets a method to override a lifetime factory.

[Obsolete("This property has no effect", true)]
public Func<Type, IApplicationLifetime?>? LifetimeOverride { get; }

Property Value

Func<Type, IApplicationLifetime>

RenderingSubsystemInitializer

Gets or sets a method to call the initialize the windowing subsystem.

public Action? RenderingSubsystemInitializer { get; }

Property Value

Action

RenderingSubsystemName

Gets the name of the currently selected rendering subsystem.

public string? RenderingSubsystemName { get; }

Property Value

string

RuntimePlatformServicesInitializer

Gets or sets a method to call the initialize the runtime platform services (e. g. AssetLoader)

public Action? RuntimePlatformServicesInitializer { get; }

Property Value

Action

RuntimePlatformServicesName

Gets the name of the currently selected windowing subsystem.

public string? RuntimePlatformServicesName { get; }

Property Value

string

WindowingSubsystemInitializer

Gets or sets a method to call the initialize the windowing subsystem.

public Action? WindowingSubsystemInitializer { get; }

Property Value

Action

WindowingSubsystemName

Gets the name of the currently selected windowing subsystem.

public string? WindowingSubsystemName { get; }

Property Value

string

Methods

AfterApplicationSetup(Action<AppBuilder>)

[PrivateApi]
public AppBuilder AfterApplicationSetup(Action<AppBuilder> callback)

Parameters

callback Action<AppBuilder>

Returns

AppBuilder

AfterPlatformServicesSetup(Action<AppBuilder>)

public AppBuilder AfterPlatformServicesSetup(Action<AppBuilder> callback)

Parameters

callback Action<AppBuilder>

Returns

AppBuilder

AfterSetup(Action<AppBuilder>)

public AppBuilder AfterSetup(Action<AppBuilder> callback)

Parameters

callback Action<AppBuilder>

Returns

AppBuilder

ConfigureFonts(Action<FontManager>)

Registers an action that is executed with the current font manager.

public AppBuilder ConfigureFonts(Action<FontManager> action)

Parameters

action Action<FontManager>

The action.

Returns

AppBuilder

An AppBuilder instance.

Configure<TApp>()

Begin configuring an Application.

public static AppBuilder Configure<TApp>() where TApp : Application, new()

Returns

AppBuilder

An AppBuilder instance.

Type Parameters

TApp

The subclass of Application to configure.

Configure<TApp>(Func<TApp>)

Begin configuring an Application.

public static AppBuilder Configure<TApp>(Func<TApp> appFactory) where TApp : Application

Parameters

appFactory Func<TApp>

Factory function for TApp.

Returns

AppBuilder

An AppBuilder instance.

Type Parameters

TApp

The subclass of Application to configure.

Remarks

appFactory is useful for passing of dependencies to TApp.

SetupWithLifetime(IApplicationLifetime)

Sets up the platform-specific services for the application and initialized it with a particular lifetime, but does not run it.

public AppBuilder SetupWithLifetime(IApplicationLifetime lifetime)

Parameters

lifetime IApplicationLifetime

Returns

AppBuilder

SetupWithoutStarting()

Sets up the platform-specific services for the application, but does not run it.

public AppBuilder SetupWithoutStarting()

Returns

AppBuilder

Start(AppMainDelegate, string[])

public void Start(AppBuilder.AppMainDelegate main, string[] args)

Parameters

main AppBuilder.AppMainDelegate
args string[]

UseRenderingSubsystem(Action, string)

Specifies a rendering subsystem to use.

public AppBuilder UseRenderingSubsystem(Action initializer, string name = "")

Parameters

initializer Action

The method to call to initialize the rendering subsystem.

name string

The name of the rendering subsystem.

Returns

AppBuilder

An AppBuilder instance.

UseRuntimePlatformSubsystem(Action, string)

Specifies a runtime platform subsystem to use.

public AppBuilder UseRuntimePlatformSubsystem(Action initializer, string name = "")

Parameters

initializer Action

The method to call to initialize the runtime platform subsystem.

name string

The name of the runtime platform subsystem.

Returns

AppBuilder

An AppBuilder instance.

UseStandardRuntimePlatformSubsystem()

Specifies a standard runtime platform subsystem to use.

public AppBuilder UseStandardRuntimePlatformSubsystem()

Returns

AppBuilder

An AppBuilder instance.

UseWindowingSubsystem(Action, string)

Specifies a windowing subsystem to use.

public AppBuilder UseWindowingSubsystem(Action initializer, string name = "")

Parameters

initializer Action

The method to call to initialize the windowing subsystem.

name string

The name of the windowing subsystem.

Returns

AppBuilder

An AppBuilder instance.

With<T>(Func<T>)

Configures platform-specific options

public AppBuilder With<T>(Func<T> options)

Parameters

options Func<T>

Returns

AppBuilder

Type Parameters

T

With<T>(T)

Configures platform-specific options

public AppBuilder With<T>(T options)

Parameters

options T

Returns

AppBuilder

Type Parameters

T