ResourceDictionary Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Provides a dictionary that contains resources used by components of a Silverlight-based application.
Inheritance Hierarchy
System.Object
System.Windows.DependencyObject
System.Windows.ResourceDictionary
Namespace: System.Windows
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
<DefaultMemberAttribute("Item")> _
Public Class ResourceDictionary _
Inherits DependencyObject _
Implements IDictionary(Of Object, Object), _
ICollection(Of KeyValuePair(Of Object, Object)), IEnumerable(Of KeyValuePair(Of Object, Object)), _
IDictionary, ICollection, IEnumerable
[DefaultMemberAttribute("Item")]
public class ResourceDictionary : DependencyObject,
IDictionary<Object, Object>, ICollection<KeyValuePair<Object, Object>>,
IEnumerable<KeyValuePair<Object, Object>>, IDictionary,
ICollection, IEnumerable
<ResourceDictionary>
oneOrMoreResources
</ResourceDictionary>
<frameworkElement>
<frameworkElement.Resources>
oneOrMoreResources
</frameworkElement.Resources>
</frameworkElement>
XAML Values
- oneOrMoreResources
One or more object elements that support a XAML object element creation syntax and are intended to be referenced as keyed resources. Each resource that you specify must have a unique value as a key. See Resource Dictionaries.
The ResourceDictionary type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ResourceDictionary | Initializes a new instance of the ResourceDictionary class. |
Top
Properties
Name | Description | |
---|---|---|
Count | Gets the number of elements contained in the collection. | |
Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) | |
IsFixedSize | Gets a value indicating whether the ResourceDictionary has a fixed size. | |
IsReadOnly | Gets a value indicating whether the collection is read-only. | |
Item | Gets the element at the specified index. | |
Keys | Gets an ICollection object containing the keys of the ResourceDictionary. | |
MergedDictionaries | Gets a collection of the ResourceDictionary dictionaries that constitute the various resource dictionaries in the merged dictionaries. | |
Source | Gets or sets a URI that provides the source location of a merged resource dictionary. | |
Values | Gets an ICollection object containing the values of the ResourceDictionary. |
Top
Methods
Name | Description | |
---|---|---|
Add(Object, Object) | Adds an item to the ResourceDictionary. | |
Add(String, Object) | Adds an item to the ResourceDictionary. | |
CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) | |
Clear | Removes all items from this ResourceDictionary. | |
ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) | |
Contains | Returns a value that indicates whether a specified key exists in the ResourceDictionary. | |
CopyTo | Copies the elements of the ResourceDictionary to an Array, starting at a particular Array index. | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetAnimationBaseValue | Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) | |
GetEnumerator | Exposes the enumerator, which supports a simple iteration over a non-generic collection. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) | |
Remove(Object) | Removes a specific item from the ResourceDictionary. | |
Remove(String) | Removes a specific item from the ResourceDictionary. | |
SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Extension Methods
Name | Description | |
---|---|---|
Aggregate<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, KeyValuePair<Object, Object>, KeyValuePair<Object, Object>>) | Overloaded. Applies an accumulator function over a sequence. (Defined by Enumerable.) | |
Aggregate<KeyValuePair<Object, Object>, TAccumulate>(TAccumulate, Func<TAccumulate, KeyValuePair<Object, Object>, TAccumulate>) | Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. (Defined by Enumerable.) | |
Aggregate<KeyValuePair<Object, Object>, TAccumulate, TResult>(TAccumulate, Func<TAccumulate, KeyValuePair<Object, Object>, TAccumulate>, Func<TAccumulate, TResult>) | Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. (Defined by Enumerable.) | |
All<KeyValuePair<Object, Object>> | Determines whether all elements of a sequence satisfy a condition. (Defined by Enumerable.) | |
Any<KeyValuePair<Object, Object>>() | Overloaded. Determines whether a sequence contains any elements. (Defined by Enumerable.) | |
Any<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Determines whether any element of a sequence satisfies a condition. (Defined by Enumerable.) | |
AsEnumerable<KeyValuePair<Object, Object>> | Returns the input typed as IEnumerable<T>. (Defined by Enumerable.) | |
AsQueryable() | Overloaded. Converts an IEnumerable to an IQueryable. (Defined by Queryable.) | |
AsQueryable<KeyValuePair<Object, Object>>() | Overloaded. Converts a generic IEnumerable<T> to a generic IQueryable<T>. (Defined by Queryable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Decimal>>) | Overloaded. Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Double>>) | Overloaded. Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32>) | Overloaded. Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int32>>) | Overloaded. Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int64>) | Overloaded. Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int64>>) | Overloaded. Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Single>) | Overloaded. Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Single>>) | Overloaded. Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Double>) | Overloaded. Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Average<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Decimal>) | Overloaded. Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Cast<TResult> | Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.) | |
Concat<KeyValuePair<Object, Object>> | Concatenates two sequences. (Defined by Enumerable.) | |
Contains<KeyValuePair<Object, Object>>(KeyValuePair<Object, Object>) | Overloaded. Determines whether a sequence contains a specified element by using the default equality comparer. (Defined by Enumerable.) | |
Contains<KeyValuePair<Object, Object>>(KeyValuePair<Object, Object>, IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Determines whether a sequence contains a specified element by using a specified IEqualityComparer<T>. (Defined by Enumerable.) | |
Count<KeyValuePair<Object, Object>>() | Overloaded. Returns the number of elements in a sequence. (Defined by Enumerable.) | |
Count<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns a number that represents how many elements in the specified sequence satisfy a condition. (Defined by Enumerable.) | |
DefaultIfEmpty<KeyValuePair<Object, Object>>() | Overloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. (Defined by Enumerable.) | |
DefaultIfEmpty<KeyValuePair<Object, Object>>(KeyValuePair<Object, Object>) | Overloaded. Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. (Defined by Enumerable.) | |
Distinct<KeyValuePair<Object, Object>>() | Overloaded. Returns distinct elements from a sequence by using the default equality comparer to compare values. (Defined by Enumerable.) | |
Distinct<KeyValuePair<Object, Object>>(IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Returns distinct elements from a sequence by using a specified IEqualityComparer<T> to compare values. (Defined by Enumerable.) | |
ElementAt<KeyValuePair<Object, Object>> | Returns the element at a specified index in a sequence. (Defined by Enumerable.) | |
ElementAtOrDefault<KeyValuePair<Object, Object>> | Returns the element at a specified index in a sequence or a default value if the index is out of range. (Defined by Enumerable.) | |
Except<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>) | Overloaded. Produces the set difference of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.) | |
Except<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>, IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Produces the set difference of two sequences by using the specified IEqualityComparer<T> to compare values. (Defined by Enumerable.) | |
First<KeyValuePair<Object, Object>>() | Overloaded. Returns the first element of a sequence. (Defined by Enumerable.) | |
First<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the first element in a sequence that satisfies a specified condition. (Defined by Enumerable.) | |
FirstOrDefault<KeyValuePair<Object, Object>>() | Overloaded. Returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.) | |
FirstOrDefault<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>) | Overloaded. Groups the elements of a sequence according to a specified key selector function. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TResult>(Func<KeyValuePair<Object, Object>, TKey>, Func<TKey, IEnumerable<KeyValuePair<Object, Object>>, TResult>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TResult>(Func<KeyValuePair<Object, Object>, TKey>, Func<TKey, IEnumerable<KeyValuePair<Object, Object>>, TResult>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TElement, TResult>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. (Defined by Enumerable.) | |
GroupBy<KeyValuePair<Object, Object>, TKey, TElement, TResult>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>, Func<TKey, IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>) | Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. (Defined by Enumerable.) | |
GroupJoin<KeyValuePair<Object, Object>, TInner, TKey, TResult>(IEnumerable<TInner>, Func<KeyValuePair<Object, Object>, TKey>, Func<TInner, TKey>, Func<KeyValuePair<Object, Object>, IEnumerable<TInner>, TResult>) | Overloaded. Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. (Defined by Enumerable.) | |
GroupJoin<KeyValuePair<Object, Object>, TInner, TKey, TResult>(IEnumerable<TInner>, Func<KeyValuePair<Object, Object>, TKey>, Func<TInner, TKey>, Func<KeyValuePair<Object, Object>, IEnumerable<TInner>, TResult>, IEqualityComparer<TKey>) | Overloaded. Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparer<T> is used to compare keys. (Defined by Enumerable.) | |
Intersect<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>) | Overloaded. Produces the set intersection of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.) | |
Intersect<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>, IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Produces the set intersection of two sequences by using the specified IEqualityComparer<T> to compare values. (Defined by Enumerable.) | |
Join<KeyValuePair<Object, Object>, TInner, TKey, TResult>(IEnumerable<TInner>, Func<KeyValuePair<Object, Object>, TKey>, Func<TInner, TKey>, Func<KeyValuePair<Object, Object>, TInner, TResult>) | Overloaded. Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. (Defined by Enumerable.) | |
Join<KeyValuePair<Object, Object>, TInner, TKey, TResult>(IEnumerable<TInner>, Func<KeyValuePair<Object, Object>, TKey>, Func<TInner, TKey>, Func<KeyValuePair<Object, Object>, TInner, TResult>, IEqualityComparer<TKey>) | Overloaded. Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer<T> is used to compare keys. (Defined by Enumerable.) | |
Last<KeyValuePair<Object, Object>>() | Overloaded. Returns the last element of a sequence. (Defined by Enumerable.) | |
Last<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the last element of a sequence that satisfies a specified condition. (Defined by Enumerable.) | |
LastOrDefault<KeyValuePair<Object, Object>>() | Overloaded. Returns the last element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.) | |
LastOrDefault<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.) | |
LongCount<KeyValuePair<Object, Object>>() | Overloaded. Returns an Int64 that represents the total number of elements in a sequence. (Defined by Enumerable.) | |
LongCount<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns an Int64 that represents how many elements in a sequence satisfy a condition. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>() | Overloaded. Returns the maximum value in a generic sequence. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Decimal>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Double>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Double value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int32 value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int32>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int64>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int64 value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int64>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Single>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Single value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Single>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Single value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Double>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Double value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Decimal>) | Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Decimal value. (Defined by Enumerable.) | |
Max<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, TResult>) | Overloaded. Invokes a transform function on each element of a generic sequence and returns the maximum resulting value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>() | Overloaded. Returns the minimum value in a generic sequence. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Decimal>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Double>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Double value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int32 value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int32>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int64>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int64 value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int64>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Single>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Single value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Single>>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Single value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Double>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Double value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Decimal>) | Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Decimal value. (Defined by Enumerable.) | |
Min<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, TResult>) | Overloaded. Invokes a transform function on each element of a generic sequence and returns the minimum resulting value. (Defined by Enumerable.) | |
OfType<TResult> | Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.) | |
OrderBy<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>) | Overloaded. Sorts the elements of a sequence in ascending order according to a key. (Defined by Enumerable.) | |
OrderBy<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>, IComparer<TKey>) | Overloaded. Sorts the elements of a sequence in ascending order by using a specified comparer. (Defined by Enumerable.) | |
OrderByDescending<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>) | Overloaded. Sorts the elements of a sequence in descending order according to a key. (Defined by Enumerable.) | |
OrderByDescending<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>, IComparer<TKey>) | Overloaded. Sorts the elements of a sequence in descending order by using a specified comparer. (Defined by Enumerable.) | |
Reverse<KeyValuePair<Object, Object>> | Inverts the order of the elements in a sequence. (Defined by Enumerable.) | |
Select<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, TResult>) | Overloaded. Projects each element of a sequence into a new form. (Defined by Enumerable.) | |
Select<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, Int32, TResult>) | Overloaded. Projects each element of a sequence into a new form by incorporating the element's index. (Defined by Enumerable.) | |
SelectMany<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, IEnumerable<TResult>>) | Overloaded. Projects each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence. (Defined by Enumerable.) | |
SelectMany<KeyValuePair<Object, Object>, TResult>(Func<KeyValuePair<Object, Object>, Int32, IEnumerable<TResult>>) | Overloaded. Projects each element of a sequence to an IEnumerable<T>, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. (Defined by Enumerable.) | |
SelectMany<KeyValuePair<Object, Object>, TCollection, TResult>(Func<KeyValuePair<Object, Object>, Int32, IEnumerable<TCollection>>, Func<KeyValuePair<Object, Object>, TCollection, TResult>) | Overloaded. Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element. (Defined by Enumerable.) | |
SelectMany<KeyValuePair<Object, Object>, TCollection, TResult>(Func<KeyValuePair<Object, Object>, IEnumerable<TCollection>>, Func<KeyValuePair<Object, Object>, TCollection, TResult>) | Overloaded. Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. (Defined by Enumerable.) | |
SequenceEqual<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>) | Overloaded. Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. (Defined by Enumerable.) | |
SequenceEqual<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>, IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer<T>. (Defined by Enumerable.) | |
Single<KeyValuePair<Object, Object>>() | Overloaded. Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by Enumerable.) | |
Single<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by Enumerable.) | |
SingleOrDefault<KeyValuePair<Object, Object>>() | Overloaded. Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by Enumerable.) | |
SingleOrDefault<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by Enumerable.) | |
Skip<KeyValuePair<Object, Object>> | Bypasses a specified number of elements in a sequence and then returns the remaining elements. (Defined by Enumerable.) | |
SkipWhile<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. (Defined by Enumerable.) | |
SkipWhile<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32, Boolean>) | Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Decimal>>) | Overloaded. Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Double>>) | Overloaded. Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32>) | Overloaded. Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int32>>) | Overloaded. Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int64>) | Overloaded. Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Int64>>) | Overloaded. Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Single>) | Overloaded. Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Nullable<Single>>) | Overloaded. Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Double>) | Overloaded. Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Sum<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Decimal>) | Overloaded. Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.) | |
Take<KeyValuePair<Object, Object>> | Returns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.) | |
TakeWhile<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Returns elements from a sequence as long as a specified condition is true. (Defined by Enumerable.) | |
TakeWhile<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32, Boolean>) | Overloaded. Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. (Defined by Enumerable.) | |
ToArray<KeyValuePair<Object, Object>> | Creates an array from a IEnumerable<T>. (Defined by Enumerable.) | |
ToDictionary<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>) | Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function. (Defined by Enumerable.) | |
ToDictionary<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>, IEqualityComparer<TKey>) | Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function and key comparer. (Defined by Enumerable.) | |
ToDictionary<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>) | Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to specified key selector and element selector functions. (Defined by Enumerable.) | |
ToDictionary<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>, IEqualityComparer<TKey>) | Overloaded. Creates a Dictionary<TKey, TValue> from an IEnumerable<T> according to a specified key selector function, a comparer, and an element selector function. (Defined by Enumerable.) | |
ToList<KeyValuePair<Object, Object>> | Creates a List<T> from an IEnumerable<T>. (Defined by Enumerable.) | |
ToLookup<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>) | Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function. (Defined by Enumerable.) | |
ToLookup<KeyValuePair<Object, Object>, TKey>(Func<KeyValuePair<Object, Object>, TKey>, IEqualityComparer<TKey>) | Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function and key comparer. (Defined by Enumerable.) | |
ToLookup<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>) | Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to specified key selector and element selector functions. (Defined by Enumerable.) | |
ToLookup<KeyValuePair<Object, Object>, TKey, TElement>(Func<KeyValuePair<Object, Object>, TKey>, Func<KeyValuePair<Object, Object>, TElement>, IEqualityComparer<TKey>) | Overloaded. Creates a Lookup<TKey, TElement> from an IEnumerable<T> according to a specified key selector function, a comparer and an element selector function. (Defined by Enumerable.) | |
Union<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>) | Overloaded. Produces the set union of two sequences by using the default equality comparer. (Defined by Enumerable.) | |
Union<KeyValuePair<Object, Object>>(IEnumerable<KeyValuePair<Object, Object>>, IEqualityComparer<KeyValuePair<Object, Object>>) | Overloaded. Produces the set union of two sequences by using a specified IEqualityComparer<T>. (Defined by Enumerable.) | |
Where<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Boolean>) | Overloaded. Filters a sequence of values based on a predicate. (Defined by Enumerable.) | |
Where<KeyValuePair<Object, Object>>(Func<KeyValuePair<Object, Object>, Int32, Boolean>) | Overloaded. Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. (Defined by Enumerable.) | |
Zip<KeyValuePair<Object, Object>, TSecond, TResult> | Merges two sequences by using the specified predicate function. (Defined by Enumerable.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
ICollection<KeyValuePair<Object, Object>>.Add | Infrastructure. For a description of this member, see Add. | |
ICollection<KeyValuePair<Object, Object>>.Clear | Infrastructure. For a description of this member, see Clear. | |
ICollection<KeyValuePair<Object, Object>>.Contains | Infrastructure. For a description of this member, see Contains. | |
ICollection<KeyValuePair<Object, Object>>.CopyTo | Infrastructure. For a description of this member, see CopyTo. | |
ICollection<KeyValuePair<Object, Object>>.Count | Infrastructure. For a description of this member, see Count. | |
ICollection<KeyValuePair<Object, Object>>.IsReadOnly | Infrastructure. For a description of this member, see IsReadOnly. | |
ICollection.IsSynchronized | Infrastructure. For a description of this member, see IsSynchronized. | |
ICollection<KeyValuePair<Object, Object>>.Remove | Infrastructure. For a description of this member, see Remove. | |
ICollection.SyncRoot | Infrastructure. For a description of this member, see SyncRoot. | |
IDictionary<Object, Object>.Add | Infrastructure. For a description of this member, see Add. | |
IDictionary<Object, Object>.ContainsKey | Infrastructure. For a description of this member, see ContainsKey. | |
IDictionary<Object, Object>.Item | Infrastructure. For a description of this member, see Item. | |
IDictionary<Object, Object>.Keys | Infrastructure. For a description of this member, see Keys. | |
IDictionary<Object, Object>.Remove | Infrastructure. For a description of this member, see Remove. | |
IDictionary<Object, Object>.TryGetValue | Infrastructure. For a description of this member, see TryGetValue. | |
IDictionary<Object, Object>.Values | Infrastructure. For a description of this member, see Values. | |
IEnumerable<KeyValuePair<Object, Object>>.GetEnumerator | Infrastructure. For a description of this member, see IEnumerable<T>.GetEnumerator. | |
IEnumerable.GetEnumerator | Infrastructure. For a description of this member, see IEnumerable.GetEnumerator. |
Top
Remarks
More documentation on ResourceDictionary and related API such as StaticResource Markup Extension are available in the topic Resource Dictionaries.
Because resource dictionaries are inherently a feature for Silverlight XAML, XAML usages of ResourceDictionary are more common than code usages, although code usages are possible. Defining keyed resources in markup that are referenced later as templates or additional resources required by such templates is one of the main scenarios in Silverlight development.
Note: |
---|
From Silverlight 3 onward, ResourceDictionary supports IEnumerable by returning a valid enumerator, which previous versions did not. The enumerator returned by GetEnumerator provides access to a basic enumeration over the immediate (non-merged) ResourceDictionary, for example to obtain a list of all the keys that have already been declared. |
Keys
ResourceDictionary supports collection APIs that support two signatures for the type of the key component, one that takes strings and one that takes Object. Most Silverlight scenarios should use strings as the resource key for resources in a ResourceDictionary. The Object as key signatures exist for compatibility and for interface conformance, but internally the dictionary is implemented such that only strings are accepted as keys. See "Keys and Resources" section of Resource Dictionaries.
In XAML, the keys for ResourceDictionary items are declared by setting the x:Key Attribute. Attempting to add a child element for a ResourceDictionary that does not have a key value throws a parse exception or run time exception. However, there are cases where no exception is thrown:
ResourceDictionary supports a legacy usage where items in the dictionary can use x:Name rather than x:Key as the key when defined in XAML. See Resource Dictionaries.
While not strictly speaking a child element, any dictionaries for MergedDictionaries do not require (and should not have) a key.
A Style can use its TargetType as an implicit key, but this technique only works within the context of the templates defined for a control in generic.xaml. For more information, see Control Customization.
Notes on XAML Syntax
Notice that the XAML implicit collection syntax for ResourceDictionary shown above does not include an element for the ResourceDictionary. This is an example of XAML implicit collection syntax; a tag representing the collection element can be omitted. The elements that are added as items to the collection are specified as child elements of a property element of a property whose underlying type supports a dictionary Add method.
The Object Element Syntax shown is generally usable only at the root of a loose XAML file, unless a custom type supports constructing new ResourceDictionary instances for a particular property.
For a merged resource dictionary, there are a minimum of two ResourceDictionary object elements involved, and you use the following syntax:
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="uri" />
...
</ResourceDictionary.MergedDictionaries>
...
</ResourceDictionary>
In this syntax the outer ResourceDictionary is the primary ResourceDictionary. The inner ResourceDictionary is the ResourceDictionary being merged. For more information, see MergedDictionaries or Resource Dictionaries.
For the implicit collection usage, the placeholder as appropriate for the property FrameworkElement.Resources is shown. You could also use this implicit collection usage for the Application.Resources property, or potentially for a custom property that uses ResourceDictionary as its property type.
Shareable Types and UIElement Types
A resource dictionary is a technique for defining shareable types and values of these types in XAML. Not all types or values are suitable for usage from a ResourceDictionary. For more information on which types are considered shareable in Silverlight, see Resource Dictionaries.
In particular, all UIElement derived types are not shareable unless they come from templates and application of a template on a specific control instance. Excluding the template case, a UIElement is expected to only exist in one place in an object tree once instantiated, and having a UIElement be shareable would potentially violate this principle.
Silverlight enforces shareable type usages differently than the equivalent ResourceDictionary implementation in WPF. In Silverlight, attempting to specify a resource that is not shareable does not generate parse exceptions against the ResourceDictionary declaration. Instead, you will get a parse exception against any StaticResource Markup Extension usage that attempts to reference that resource, even as the first time. The specific parse exception will report in the message that the value is out of range.
In code, if you try to access a nonshareable ResourceDictionary, you can retrieve the item successfully as an object. However, if you attempt to add the returned object to any point in the object tree, you get an exception where the message reads: Element is already the child of another element.
In contrast, WPF permits you to place a UIElement in a ResourceDictionary, and you can successfully reference it and connect it to the object tree exactly once. However, if you attempt to add a second reference to that object and connect it to the object tree again in WPF (either in XAML or code), you get an exception that indicates you have attempted to reparent an object that is already in the object tree.
For more information on other resource dictionary differences between Silverlight and WPF, see XAML Processing Differences Between Silverlight Versions and WPF.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also