Search code examples
c#winformspropertygriddesign-surface

Set Value of Property When Delete Key is Pressed in PropertyGrid


I am currently working on a project that hosts WinForms designer. I am using PropertyGrid to display manipulate properties of the controls that are dropped on the DesignSurface.

I have created UITypeEditor's to modify values of my custom controls properties.

How can I reset the value of the property to null when Delete key is pressed in the PropertyGrid.


Solution

  • This is handled in the PropertyDescriptor.

    You override ResetValue and CanResetValue.