Table of Contents

Class StyleBase

Namespace
Avalonia.Styling
Assembly
Avalonia.Base.dll

Base class for Style and ControlTheme.

public abstract class StyleBase : AvaloniaObject, INotifyPropertyChanged, IStyle, IResourceProvider, IResourceNode
Inheritance
StyleBase
Implements
Derived
Inherited Members
Extension Methods

Constructors

StyleBase()

protected StyleBase()

Properties

Animations

public IList<IAnimation> Animations { get; }

Property Value

IList<IAnimation>

Children

public IList<IStyle> Children { get; }

Property Value

IList<IStyle>

Owner

Gets the owner of the resource provider.

public IResourceHost? Owner { get; }

Property Value

IResourceHost

Remarks

If multiple owners are added, returns the first.

Parent

public IStyle? Parent { get; }

Property Value

IStyle

Resources

public IResourceDictionary Resources { get; set; }

Property Value

IResourceDictionary

Setters

public IList<SetterBase> Setters { get; }

Property Value

IList<SetterBase>

Methods

Add(IStyle)

public void Add(IStyle style)

Parameters

style IStyle

Add(SetterBase)

public void Add(SetterBase setter)

Parameters

setter SetterBase

TryGetResource(object, ThemeVariant?, out object?)

Tries to find a resource within the object.

public bool TryGetResource(object key, ThemeVariant? themeVariant, out object? result)

Parameters

key object

The resource key.

themeVariant ThemeVariant
result object

Returns

bool

True if the resource if found, otherwise false.

Events

OwnerChanged

Raised when the Owner of the resource provider changes.

public event EventHandler? OwnerChanged

Event Type

EventHandler