Class Classes
Holds a collection of style classes for an StyledElement.
public class Classes : AvaloniaList<string>, IAvaloniaList<string>, IList<string>, ICollection<string>, IAvaloniaReadOnlyList<string>, IReadOnlyList<string>, IReadOnlyCollection<string>, IEnumerable<string>, INotifyCollectionChanged, INotifyPropertyChanged, IList, ICollection, IEnumerable, IPseudoClasses
- Inheritance
-
Classes
- Implements
- Inherited Members
- Extension Methods
Remarks
Similar to CSS, each control may have any number of styling classes applied.
Constructors
Classes()
Initializes a new instance of the Classes class.
public Classes()
Classes(IEnumerable<string>)
Initializes a new instance of the Classes class.
public Classes(IEnumerable<string> items)
Parameters
items
IEnumerable<string>The initial items.
Classes(params string[])
Initializes a new instance of the Classes class.
public Classes(params string[] items)
Parameters
items
string[]The initial items.
Methods
Add(string)
Adds a style class to the collection.
public override void Add(string name)
Parameters
name
stringThe class name.
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
AddRange(IEnumerable<string>)
Adds a style classes to the collection.
public override void AddRange(IEnumerable<string> names)
Parameters
names
IEnumerable<string>The class names.
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
Clear()
Removes all non-pseudoclasses from the collection.
public override void Clear()
Insert(int, string)
Inserts a style class into the collection.
public override void Insert(int index, string name)
Parameters
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
InsertRange(int, IEnumerable<string>)
Inserts style classes into the collection.
public override void InsertRange(int index, IEnumerable<string> names)
Parameters
index
intThe index to insert the class at.
names
IEnumerable<string>The class names.
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
Parse(string)
Parses a classes string.
public static Classes Parse(string s)
Parameters
s
stringThe string.
Returns
Remove(string)
Removes a style class from the collection.
public override bool Remove(string name)
Parameters
name
stringThe class name.
Returns
Remarks
Only standard classes may be removed via this method. To remove pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
RemoveAll(IEnumerable<string>)
Removes style classes from the collection.
public override void RemoveAll(IEnumerable<string> names)
Parameters
names
IEnumerable<string>The class name.
Remarks
Only standard classes may be removed via this method. To remove pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
RemoveAt(int)
Removes a style class from the collection.
public override void RemoveAt(int index)
Parameters
index
intThe index of the class in the collection.
Remarks
Only standard classes may be removed via this method. To remove pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.
RemoveRange(int, int)
Removes style classes from the collection.
public override void RemoveRange(int index, int count)
Parameters
Replace(IList<string>)
Removes all non-pseudoclasses in the collection and adds a new set.
public void Replace(IList<string> source)
Parameters
Set(string, bool)
Adds a or removes a style class to/from the collection.
public void Set(string name, bool value)
Parameters
Remarks
Only standard classes may be added or removed via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected PseudoClasses property.