-
Notifications
You must be signed in to change notification settings - Fork 1
net472_PropertyGridHelpers.UIEditors_ModalVisualizer 1
dparvin edited this page Jul 9, 2025
·
1 revision
Provides a reusable, generic modal visualizer for editing a property value within a PropertyGrid. This visualizer displays a modal dialog using a form of type TForm, allowing rich editing experiences beyond the standard in-place or dropdown editors.
public class ModalVisualizer<TForm> : UITypeEditor
where TForm : Form, IValueEditorForm, new()| parameter | description |
|---|---|
| TForm | A Windows Forms Form class that implements IValueEditorForm to handle the editing of the property value. |
| name | description |
|---|---|
| ModalVisualizer() | The default constructor. |
| override EditValue(…) | Displays the modal editor form to allow the user to edit the property value. |
| override GetEditStyle(…) |
To use this editor, define a custom form implementing the IValueEditorForm interface. The EditedValue property is used to push the initial value into the form and retrieve the edited value when the dialog is closed with OK.
public class CurrencyEditForm : Form, IValueEditorForm
{
public object EditedValue { get; set; }
// implement form logic here
}
[Editor(typeof(ModalVisualizer<CurrencyEditForm>), typeof(UITypeEditor))]
public decimal Amount { get; set; }- interface IValueEditorForm
- namespace PropertyGridHelpers.UIEditors
- assembly PropertyGridHelpers
- ModalVisualizer.cs