Hi group,
I have a problem using the PropertyGrid.
I'm using a PropertyGrid to show a dynamically generated option dialog.
I use an ICustomTypeDescriptor implementation together with a custom
PropertyDescriptor that fakes out the needed "properties" for the grid,
the actual values coming from a different data source, that can also
changed programmatically. The PropertyDescriptor fakes a human friendly
DisplayName and an unique PropertyName that is only used internally.
Problem: When doing a propertyGrid.Refresh(), GridItems with duplicate
DisplayNames are not handled correctly, specifically: If I change the
value for any but the first one (in current sort order), after the
refresh the FIRST one is always selected, and it shows the string
representation of the currently changed entry (however, it DOES paint
the value representation correctly). The string representation is only
displayed incorrectly, i.e. it is not written back, and after any focus
changes, it is displayed correctly. Also, if I make the DisplayNames
unique, or the PropertyType differs, the problem goes away.
It also does not depend on the PropertyDescriptor/ICustomTypeDescriptor
combo, but happens even with static properties (just checked ;-))
Has anyone else encountered this or a similar problem and/or has any
tips?
Regards
Jasper