BeepGridColumnCollectionEditor
UITypeEditor for BeepGridPro columns -- opens BeepGridColumnEditorDialog modal, forces grid layout recalculation and repaint via reflection on close
Table of Contents
Overview
Namespace: TheTechIdea.Beep.Winform.Controls.Design.Server.Editors
Inheritance: System.Drawing.Design.UITypeEditor | Visibility: public
A design-time UITypeEditor that provides a modal dialog for adding, removing, and configuring columns on a BeepGridPro control. When the user confirms changes (DialogResult.OK), it uses reflection to force grid layout recalculation and repainting. Accessed from the Properties window when the Columns property is edited or from the smart-tag "Edit Columns..." action.
Key Methods
| Method | Return Type | Description |
|---|---|---|
| GetEditStyle(context) | UITypeEditorEditStyle | Returns Modal -- specifies that editing opens a modal dialog |
| EditValue(context, provider, value) | object | Casts context.Instance to BeepGridPro. Opens BeepGridColumnEditorDialog via IWindowsFormsEditorService.ShowDialog(). On DialogResult.OK, uses reflection to call grid.Layout.Recalculate() then calls Invalidate() and Refresh(). Returns the original value unchanged. |
Edit Pipeline
- Developer clicks "..." button in the Properties window for the Columns property
GetEditStyle()returnsModalEditValue()opensBeepGridColumnEditorDialog-- a full column management form- Developer adds/removes/edits columns, clicks OK
- Editor uses reflection:
grid.GetType().GetProperty("Layout").GetValue(grid).GetType().GetMethod("Recalculate").Invoke(...) grid.Invalidate()andgrid.Refresh()to update the designer surface- Returns the original value (the editor does not modify the value directly)
Examples
// In the Visual Studio Properties window:
// Select BeepGridPro > Columns property > click "..." button
// -> BeepGridColumnCollectionEditor opens BeepGridColumnEditorDialog
// -> Configure columns, click OK
// -> Grid layout recalculates and design surface refreshes
// The Columns property has this attribute:
[Editor(typeof(BeepGridColumnCollectionEditor), typeof(UITypeEditor))]
public BeepGridColumnConfigCollection Columns { get; set; }