Class Styles
A style that consists of a number of child styles.
public class Styles : AvaloniaObject, IAvaloniaList<IStyle>, IList<IStyle>, ICollection<IStyle>, IAvaloniaReadOnlyList<IStyle>, IReadOnlyList<IStyle>, IReadOnlyCollection<IStyle>, IEnumerable<IStyle>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, IStyle, IResourceProvider, IResourceNode
- Inheritance
-
Styles
- Implements
- Inherited Members
- Extension Methods
Constructors
Styles()
public Styles()
Styles(IResourceHost)
public Styles(IResourceHost owner)
Parameters
owner
IResourceHost
Properties
Count
Gets the number of items in the list.
public int Count { get; }
Property Value
this[int]
Gets or sets the element at the specified index.
public IStyle this[int index] { get; set; }
Parameters
index
intThe index.
Property Value
- IStyle
The element at the requested index.
Owner
Gets the owner of the resource provider.
public IResourceHost? Owner { get; }
Property Value
Remarks
If multiple owners are added, returns the first.
Resources
Gets or sets a dictionary of style resources.
public IResourceDictionary Resources { get; set; }
Property Value
Methods
Add(IStyle)
public void Add(IStyle item)
Parameters
item
IStyle
AddRange(IEnumerable<IStyle>)
Adds multiple items to the collection.
public void AddRange(IEnumerable<IStyle> items)
Parameters
items
IEnumerable<IStyle>The items.
Clear()
public void Clear()
Contains(IStyle)
public bool Contains(IStyle item)
Parameters
item
IStyle
Returns
CopyTo(IStyle[], int)
public void CopyTo(IStyle[] array, int arrayIndex)
Parameters
GetEnumerator()
public AvaloniaList<IStyle>.Enumerator GetEnumerator()
Returns
IndexOf(IStyle)
public int IndexOf(IStyle item)
Parameters
item
IStyle
Returns
Insert(int, IStyle)
public void Insert(int index, IStyle item)
Parameters
InsertRange(int, IEnumerable<IStyle>)
Inserts multiple items at the specified index.
public void InsertRange(int index, IEnumerable<IStyle> items)
Parameters
index
intThe index.
items
IEnumerable<IStyle>The items.
Move(int, int)
Moves an item to a new index.
public void Move(int oldIndex, int newIndex)
Parameters
MoveRange(int, int, int)
Moves multiple items to a new index.
public void MoveRange(int oldIndex, int count, int newIndex)
Parameters
oldIndex
intThe first index of the items to move.
count
intThe number of items to move.
newIndex
intThe index to move the items to.
Remove(IStyle)
public bool Remove(IStyle item)
Parameters
item
IStyle
Returns
RemoveAll(IEnumerable<IStyle>)
Removes multiple items from the collection.
public void RemoveAll(IEnumerable<IStyle> items)
Parameters
items
IEnumerable<IStyle>The items.
RemoveAt(int)
public void RemoveAt(int index)
Parameters
index
int
RemoveRange(int, int)
Removes a range of elements from the collection.
public void RemoveRange(int index, int count)
Parameters
TryGetResource(object, ThemeVariant?, out object?)
Tries to find a resource within the object.
public bool TryGetResource(object key, ThemeVariant? theme, out object? value)
Parameters
key
objectThe resource key.
theme
ThemeVariantTheme used to select theme dictionary.
value
objectWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise, null.
Returns
- bool
True if the resource if found, otherwise false.
Events
CollectionChanged
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
OwnerChanged
Raised when the Owner of the resource provider changes.
public event EventHandler? OwnerChanged