I've found what I think is a bug in the PropertyGridDataAccessor.Refresh method, or possibly with the OnValue(s?)Changed method.
I ran into this via two routes:
1) I have some remaining degenerate scenarios in my app where the object exposed on the grid has properties changed without sending PropertyChanged events. I currently work around these scenarios by calling Refresh() on all the PropertyGridDataAccessor items when one occurs (calling Refresh on the grid itself does too deep a rebuild, loses selection context and such).
2) I have some properties that are objects implementing ICustonTypeDescriptor and which have a TypeConverter deriving from ExpandableObjectConverter. I added code so that the child properties all express the NotifyParentPropertyAttribute, and that does make the value of the parent property refresh.
The bug is that, in both of these scenarios, the IsModified nature of the properties does not refresh. For example, if I have a property under scenario 2 set to its default, expand it, and change a child property, the value displayed on the parent property row refreshes, but the bold-ness doesn't refresh, and I can see in the debugger that the corresponding PropertyGridDataAccessorItem has IsModified == false, and IsModifiedInternal == true.
The same scenario happens when calling Refresh on a PropertyGridDataAccessorItem whose underlying property changed "silently", the value updates, but IsModified does not.
I ran into this via two routes:
1) I have some remaining degenerate scenarios in my app where the object exposed on the grid has properties changed without sending PropertyChanged events. I currently work around these scenarios by calling Refresh() on all the PropertyGridDataAccessor items when one occurs (calling Refresh on the grid itself does too deep a rebuild, loses selection context and such).
2) I have some properties that are objects implementing ICustonTypeDescriptor and which have a TypeConverter deriving from ExpandableObjectConverter. I added code so that the child properties all express the NotifyParentPropertyAttribute, and that does make the value of the parent property refresh.
The bug is that, in both of these scenarios, the IsModified nature of the properties does not refresh. For example, if I have a property under scenario 2 set to its default, expand it, and change a child property, the value displayed on the parent property row refreshes, but the bold-ness doesn't refresh, and I can see in the debugger that the corresponding PropertyGridDataAccessorItem has IsModified == false, and IsModifiedInternal == true.
The same scenario happens when calling Refresh on a PropertyGridDataAccessorItem whose underlying property changed "silently", the value updates, but IsModified does not.