In This Article

ThemeGenerator Class

Generates a theme that can be used with ModernTheme.

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

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?

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?

GetBrushResource(ThemeGeneratorSession, ThemeResourceKind)

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

protected virtual IBrush? 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

IBrush

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?

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?

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?

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?

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

GetFontStyleResource(ThemeGeneratorSession, ThemeResourceKind)

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

protected virtual FontStyle? GetFontStyleResource(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

FontStyle?

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?

GetGradientStopsResource(ThemeGeneratorSession, ThemeResourceKind)

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

protected virtual GradientStops? GetGradientStopsResource(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

GradientStops

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?

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