Classes Class

Summary

Holds a collection of style classes for an IStyledElement.
Namespace
Avalonia.Controls
Interfaces
Base Types
graph TD Base0["AvaloniaList<string>"]-->Type Base1["object"]-->Base0 Interface0["IAvaloniaList<string>"]-.->Type Interface1["IList<string>"]-.->Type Interface2["ICollection<string>"]-.->Type Interface3["IAvaloniaReadOnlyList<string>"]-.->Type Interface4["IReadOnlyList<string>"]-.->Type Interface5["IReadOnlyCollection<string>"]-.->Type Interface6["IEnumerable<string>"]-.->Type Interface7["INotifyCollectionChanged"]-.->Type Interface8["INotifyPropertyChanged"]-.->Type Interface9["IList"]-.->Type Interface10["ICollection"]-.->Type Interface11["IEnumerable"]-.->Type Interface12["INotifyCollectionChangedDebug"]-.->Type click Interface12 "/api/Avalonia.Diagnostics/INotifyCollectionChangedDebug" Interface13["IPseudoClasses"]-.->Type click Interface13 "/api/Avalonia.Controls/IPseudoClasses" Type["Classes"] class Type type-node

Syntax

public class Classes : AvaloniaList<string>, IAvaloniaList<string>, IList<string>, 
    ICollection<string>, IAvaloniaReadOnlyList<string>, IReadOnlyList<string>, 
    IReadOnlyCollection<string>, IEnumerable<string>, INotifyCollectionChanged, 
    INotifyPropertyChanged, IList, ICollection, IEnumerable, INotifyCollectionChangedDebug, 
    IPseudoClasses

Remarks

Similar to CSS, each control may have any number of styling classes applied.

Constructors

Name Summary
Classes() Initializes a new instance of the Classes class.
Classes(IEnumerable<string>) Initializes a new instance of the Classes class.
Classes(string[]) Initializes a new instance of the Classes class.

Methods

Name Value Summary
Add(string) void
Adds a style class to the collection.
AddRange(IEnumerable<string>) void
Adds a style classes to the collection.
Clear() void
Remvoes all non-pseudoclasses from the collection.
Insert(int, string) void
Inserts a style class into the collection.
InsertRange(int, IEnumerable<string>) void
Inserts style classes into the collection.
Parse(string) Classes
Parses a classes string.
static
Remove(string) bool
Removes a style class from the collection.
RemoveAll(IEnumerable<string>) void
Removes style classes from the collection.
RemoveAt(int) void
Removes a style class from the collection.
RemoveRange(int, int) void
Removes style classes from the collection.
Replace(IList<string>) void
Removes all non-pseudoclasses in the collection and adds a new set.

Extension Methods

Name Value Summary
CreateDerivedList<string, TDerived>(Func<string, TDerived>) IAvaloniaReadOnlyList<TDerived>
ForEachItem<string>(Action<int, string>, Action<int, string>, Action, bool) IDisposable
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
ForEachItem<string>(Action<string>, Action<string>, Action, bool) IDisposable
Invokes an action for each item in a collection and subsequently each item added or removed from the collection.
Set(string, bool) void
Adds or removes a pseudoclass depending on a boolean value.
Set(string, IObservable<bool>) IDisposable
Sets a pseudoclass depending on an observable trigger.
TrackItemPropertyChanged<string>(Action<Tuple<object, PropertyChangedEventArgs>>) IDisposable
Listens for property changed events from all items in a collection.