Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft