Classes Class
Definition
Holds a collection of style classes for an Avalonia.StyledElement.
public class Classes
Remarks
Similar to CSS, each control may have any number of styling classes applied.
Constructors
| Name | Description |
|---|---|
| Classes (3 overloads) | Initializes a new instance of the Avalonia.Controls.Classes class. |
Classes overloads
Classes Constructor
Initializes a new instance of the Avalonia.Controls.Classes class.
public Classes()
Classes Constructor
public Classes(System.Collections.Generic.IEnumerable<string> items)
Parameters
items System.Collections.Generic.IEnumerable<string>
Classes Constructor
Initializes a new instance of the Avalonia.Controls.Classes class.
public Classes(string[] items)
Parameters
items string[]
The initial items.
Methods
| Name | Description |
|---|---|
| Add | Adds a style class to the collection. |
| AddRange | No summary available. |
| Clear | Removes all non-pseudoclasses from the collection. |
| Insert | Inserts a style class into the collection. |
| InsertRange | No summary available. |
| Parse | Parses a classes string. |
| Remove | Removes a style class from the collection. |
| RemoveAll | No summary available. |
| RemoveAt | Removes a style class from the collection. |
| RemoveRange | Removes style classes from the collection. |
| Replace | No summary available. |
| Set | Adds a or removes a style class to/from the collection. |
Add Method
Adds a style class to the collection.
public void Add(string name)
Parameters
name string
The class name.
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected Avalonia.StyledElement.PseudoClasses property.
AddRange Method
public void AddRange(System.Collections.Generic.IEnumerable<string> names)
Parameters
names System.Collections.Generic.IEnumerable<string>
Clear Method
Removes all non-pseudoclasses from the collection.
public void Clear()
Insert Method
Inserts a style class into the collection.
public void Insert(int index, string name)
Parameters
index int
The index to insert the class at.
name string
The class name.
Remarks
Only standard classes may be added via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected Avalonia.StyledElement.PseudoClasses property.
InsertRange Method
public void InsertRange(int index, System.Collections.Generic.IEnumerable<string> names)
Parameters
index int
names System.Collections.Generic.IEnumerable<string>
Parse Method
Parses a classes string.
public Avalonia.Controls.Classes Parse(string s)
Parameters
s string
The string.
Returns
Remove Method
Removes a style class from the collection.
public bool Remove(string name)
Parameters
name string
The class name.
Returns
bool
Remarks
Only standard classes may be removed via this method. To remove pseudoclasses (classes beginning with a ':' character) use the protected Avalonia.StyledElement.PseudoClasses property.
RemoveAll Method
public void RemoveAll(System.Collections.Generic.IEnumerable<string> names)
Parameters
names System.Collections.Generic.IEnumerable<string>
RemoveAt Method
Removes a style class from the collection.
public void RemoveAt(int index)
Parameters
index int
The 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 Avalonia.StyledElement.PseudoClasses property.
RemoveRange Method
Removes style classes from the collection.
public void RemoveRange(int index, int count)
Parameters
index int
The first index to remove.
count int
The number of items to remove.
Replace Method
public void Replace(System.Collections.Generic.IList<string> source)
Parameters
source System.Collections.Generic.IList<string>
Set Method
Adds a or removes a style class to/from the collection.
public void Set(string name, bool value)
Parameters
name string
The class names.
value bool
If true adds the class, if false, removes it.
Remarks
Only standard classes may be added or removed via this method. To add pseudoclasses (classes beginning with a ':' character) use the protected Avalonia.StyledElement.PseudoClasses property.