Indexer Support
In R2 2016, Telerik introduced Indexer Support for RadPropertyGrid's PropertyDefinition bindings. It covers the following scenarios:
For the purposes of this article, we will assume the following class hierarchy is present:
Example 1: The class hierarchy
Binding to an Item of a Collection Through Indexer
A common scenario when using RadPropertyGrid is when we have a collection member of our business object. Example 2 shows how to bind to an item at a specified index in the collection:
Example 2: Binding to a collection
Binding of NestedProperties
You can also use indexing in NestedProperties, as shown in Example 3:
Example 3: Binding of NestedProperties
Binding to a Collection Property with a String Key
As our League class has a Dictionary of clubs, we can access any club by its name, as demonstrated in Example 4.
Example 4: Binding to item in Dictionary
Binding to an Item which Implements an Indexer
Since our Club class implements an indexer, we can also bind to the Player, whose number is 25, for example:
Example 5: Indexing a class that implements indexer
Using Unbound Mode
Indexer support also works when AutoGenerateBindingPaths is set to False.