Handle SavePropertyPersistence and LoadPropertyPersistence Events
The SavePropertyPersistence event argument SavePropertyPersistenceEventArgs contains information about the property being saved. You could avoid saving a control’s property if the SavePropertyPersistenceEventArgs object’s Cancel property is set to True.
The LoadPropertyPersistence event argument LoadPropertyPersistenceEventArgs contains information about the property being loaded. You could avoid loading a control’s property if the LoadPropertyPersistenceEventArgs object’s Handled property is set to True.
The following example will show you how to register and use the events for a PersistenceSettings object.
You will validate properties and cancel, save or load if the properties don’t meet certain criteria. During the save process you will cancel the saving of control’s Width property. During load, you will check the Height property value.