I use a PropertyGrid to display all objects (their classes derive from class "A") which are bound to another object (class "B"). The amount of "A"s may change while a "B" is displayed. For this to work, I manually create PropertyGridPropertyItems with an "A" as value and add them to the PropertyGridCategoryItem's Accessors-collection.
I want the "A"s to be displayed differently, based on their actual type. This works for non-expandable "A"s using my own editors which are chosen upon the PropertyType. (That's why I assign the "A" to the PropertyGridPropertyItems' value and not just the to-be-displayed data of "A".)
Instances of the class "C" (which is derived from "A") have a list (property "Values") of integers which I want to be displayed as nested properties. Using my own TypeConverter (derived from ExpandableObjectConverter) the PropertyGrid offers me the possibility to expand "C"s and shows all of the integers as children. But I only get a kind of snapshot of the integers. When the values change the child-nodes are not updated. Nevertheless the value displayed at the "C"-node (a string containing all integers) gets updated. (This string is always created when a PropertyChanged of the "Values"-property is received.)
My TypeConverter creates instances of my IndexedValueDescriptor class (derived form PropertyDescriptor) and initializes each one of them with a display-name, a property-name and the index of the integer (inside the "Values"-list). The GetValue-method takes the provided object, uses reflection to find the property and returns the element described by the index.
I want that changes to the integers get visible when PropertyChanged for "Values" is fired. My first guess was that the values are not updated because nobody tells the PropertyGrid to do so. So I put a breakpoint to the PropertyDescriptor.AddValueChanged method to peek if something registers an eventhandler. Unfortunately, this is not the case. Firing the ValueChanged event periodically (just for testing purposes) showed no result.
Does anybody have an idea what I can try to get my desired result? A hint where to dig for a solution may be sufficient.
Thanks for your help,