Skip to main content

ResourceDictionary Class

Definition

Assembly:Avalonia.Base
Package:Avalonia

An indexed dictionary of resources.

public class ResourceDictionary

Inheritance: object -> AvaloniaObject -> ResourceProvider -> ResourceDictionary

Implements: IResourceDictionary, IResourceNode, IResourceProvider, IThemeVariantProvider, ICollection<KeyValuePair<object,object>>, IDictionary<object,object>, IEnumerable<KeyValuePair<object,object>>, IEnumerable

Constructors

NameDescription
ResourceDictionary (2 overloads)Initializes a new instance of the Avalonia.Controls.ResourceDictionary class.

ResourceDictionary overloads

ResourceDictionary Constructor

Initializes a new instance of the Avalonia.Controls.ResourceDictionary class.

public ResourceDictionary()

ResourceDictionary Constructor

Initializes a new instance of the Avalonia.Controls.ResourceDictionary class.

public ResourceDictionary(Avalonia.Controls.IResourceHost owner)
Parameters

owner Avalonia.Controls.IResourceHost

Methods

NameDescription
AddNo summary available.
AddDeferred (2 overloads)No summary available.
AddNotSharedDeferredNo summary available.
ClearNo summary available.
ContainsKeyNo summary available.
EnsureCapacityEnsures that the resource dictionary can hold up to capacity entries without any further expansion of its backing storage.
GetEnumeratorNo summary available.
RemoveNo summary available.
SetItemsNo summary available.
TryGetResourceNo summary available.
TryGetValueNo summary available.
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Add Method

public void Add(object key, object value)

Parameters

key object

value object

AddDeferred overloads

AddDeferred Method

public void AddDeferred(object key, Avalonia.Controls.IDeferredContent deferredContent)
Parameters

key object

deferredContent Avalonia.Controls.IDeferredContent

AddDeferred Method

public void AddDeferred(object key, Func<IServiceProvider, object> factory)
Parameters

key object

factory Func<IServiceProvider, object>

AddNotSharedDeferred Method

public void AddNotSharedDeferred(object key, Avalonia.Controls.IDeferredContent deferredContent)

Parameters

key object

deferredContent Avalonia.Controls.IDeferredContent

Clear Method

public void Clear()

ContainsKey Method

public bool ContainsKey(object key)

Parameters

key object

Returns

bool

EnsureCapacity Method

Ensures that the resource dictionary can hold up to capacity entries without any further expansion of its backing storage.

public void EnsureCapacity(int capacity)

Parameters

capacity int

Remarks

This method may have no effect when targeting .NET Standard 2.0.

GetEnumerator Method

public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<object,object>> GetEnumerator()

Returns

System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<object,object>>

Remove Method

public bool Remove(object key)

Parameters

key object

Returns

bool

SetItems Method

public void SetItems(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<object,object>> values)

Parameters

values System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<object,object>>

TryGetResource Method

public bool TryGetResource(object key, Avalonia.Styling.ThemeVariant theme, object& value)

Parameters

key object

theme Avalonia.Styling.ThemeVariant

value object&

Returns

bool

TryGetValue Method

public bool TryGetValue(object key, object& value)

Parameters

key object

value object&

Returns

bool

Properties

NameDescription
CountNo summary available.
HasResourcesNo summary available.
ItemNo summary available.
KeysNo summary available.
MergedDictionariesNo summary available.
ThemeDictionariesNo summary available.
ValuesNo summary available.
OwnerGets the owner of the resource provider. Inherited from ResourceProvider.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.

Count Property

public int Count { get; set; }

HasResources Property

public bool HasResources { get; set; }

Item Property

public object Item { get; set; }

Keys Property

public System.Collections.Generic.ICollection<object> Keys { get; set; }

MergedDictionaries Property

public System.Collections.Generic.IList<Avalonia.Controls.IResourceProvider> MergedDictionaries { get; set; }

ThemeDictionaries Property

public System.Collections.Generic.IDictionary<Avalonia.Styling.ThemeVariant, Avalonia.Controls.IThemeVariantProvider> ThemeDictionaries { get; set; }

Values Property

public System.Collections.Generic.ICollection<object> Values { get; set; }

Events

NameDescription
OwnerChangedRaised when the Avalonia.Controls.IResourceProvider.Owner of the resource provider changes. Inherited from ResourceProvider.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.