Most of the elegance of PropertyGrid comes from its simplicity. First of all, it is intended for pleasant communication with Visual Studio, and I expect to see that it is used mainly in custom UITypeEditor and extensions, and not in the application code.
Presumably the objects you attach to the PropertyGrid are classes of your own design? I found that in order to make good use of the property grid, you must pretty much decorate your classes and members with attributes.
You may find some joy in writing your own CollectionEditor subclasses (and other types of editors) and attaching them to class members using the [Editor] attribute - if you can attach this attribute to your dynamic properties, you can force the use of a specific editor.
The only way I can add validation to CollectionEditor is to override the CreateCollectionForm() method, returning an instance of your own custom subclass of CollectionEditor.CollectionForm . There is a chance that you can trigger change events here.
Unfortunately, all I can do is nod and agree with the statement to cancel the cancellation. You may need to resort to "backing up" affected objects by cloning or serializing to implement undo.
I have seen alternatives to the built-in network control, but they exist mainly for creating different visual styles.
Bradley smith
source share