Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ResourceDictionary.Item Property

Gets the element at the specified index.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public Object this[
	Object key
] { get; set; }

Parameters

key
Type: System.Object
The key of the element to get.

Property Value

Type: System.Object
The object if it exists; otherwise, null.

Implements

IDictionary.Item[Object]

ExceptionCondition
NotImplementedException

Attempted to set a value using the indexer.

ArgumentNullException

key is null.

ArgumentException

key is not a string.

The main scenario for using the ResourceDictionary is to retrieve resources from a specific Silverlight ResourceDictionary at run time. For more information, see Referencing Resources from Code.

This indexer implementation specifically blocks a "set" usage. If you attempt to set a value using the indexer, an exception is thrown. You must remove and re-add to the ResourceDictionary in order to change a key-value pair.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft