Question

I'm using the PropertyGrid (in the CollectionEditor) to edit some properties of a class. The properties are actually wrapped in classes that implement ICustomTypeDescriptor. One of them uses a custom editor that inherits from UITypeEditor. When the user changes the value of this property in the custom editor, the value of another property is also being updated (by code in the custom editor; the property wrapper has a reference to the other property for this reason). So far so good.

But when the user closes the custom editor, the PropertyGrid only shows the new value of the edited property and does not refresh the other property (even though its value has definitely changed).

How can I refresh the entire containing PropertyGrid from the custom editor?

Was it helpful?

Solution

I found the solution myself:

The EditValue method of the custom editor should return a new object, not the passed in value object. Then the PropertyGrid automatically refreshes the other properties as well.

I did not need to use the RefreshProperties attribute anywhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top