In This Article

ThemeGenerator Class

Generates a theme that can be used with the ThemeManager.

public class ThemeGenerator
Inheritance:
object object

Constructors

ThemeGenerator()

Initializes an instance of the class.

public ThemeGenerator()

Methods

Generate(ThemeDefinition)

Generates a Avalonia.Controls.ResourceDictionary based on supplied ThemeDefinition.

public ResourceDictionary Generate(ThemeDefinition definition)
Parameter Type Description
definition ThemeDefinition

The ThemeDefinition to use.

Returns

ResourceDictionary:

The Avalonia.Controls.ResourceDictionary that was generated.

GetBooleanResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the bool resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual bool? GetBooleanResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

bool?:

The resource value.

GetBoxShadowsResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Media.BoxShadows resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual BoxShadows? GetBoxShadowsResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

BoxShadows?:

The resource value.

GetBrushResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Media.Brush resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual Brush? GetBrushResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

Brush:

The resource value.

GetCharResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the char resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual char? GetCharResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

char?:

The resource value.

GetColorResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Media.Color resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual Color? GetColorResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

Color?:

The resource value.

GetCornerRadiusResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.CornerRadius resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual CornerRadius? GetCornerRadiusResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

CornerRadius?:

The resource value.

GetDoubleResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the double resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual double? GetDoubleResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

double?:

The resource value.

GetFontFamilyResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Media.FontFamily resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual FontFamily? GetFontFamilyResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

FontFamily:

The resource value.

GetFontWeightResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Media.FontWeight resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual FontWeight? GetFontWeightResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

FontWeight?:

The resource value.

GetThicknessResource(ThemeGeneratorSession, ThemeResourceKind)

Returns the Avalonia.Thickness resource value designated by a ThemeResourceKind for the specified ThemeGeneratorSession.

protected virtual Thickness? GetThicknessResource(ThemeGeneratorSession session, ThemeResourceKind resourceKind)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession requesting the resource value.

resourceKind ThemeResourceKind

A ThemeResourceKind indicating the kind of resource.

Returns

Thickness?:

The resource value.

OnSessionCompleted(ThemeGeneratorSession)

Occurs when the specified ThemeGeneratorSession has completed loading resources, allowing for any final customization.

protected virtual void OnSessionCompleted(ThemeGeneratorSession session)
Parameter Type Description
session ThemeGeneratorSession

The ThemeGeneratorSession that has completed. Examine its ThemeVariant property to know if the session was for common resources or for theme variant-specific resources.

Inherited Members

Extension Methods