VGridControlBase.CustomizationForm Property
Provides access to the Customization Form.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v19.1.dll
Declaration
Property Value
Type | Description |
---|---|
VGridCustomizationForm | A VGridCustomizationForm object that represents the Customization Form. null (Nothing in Visual Basic) if the Customization Form is closed. |
Remarks
The Customization Form allows end-users to hide rows and make them visible again. The CustomizationForm property provides access to the Customization Form’s settings. This property’s return value is a Form descendant. You can change the form’s caption, assign a context menu to it, change its position, etc.
Note
The Customization Form is recreated with default settings each time it is displayed. All changes made are lost between hiding the form and showing it again. You need to handle the VGridControlBase.ShowCustomizationForm event to apply the desired changes each time the Customization Form is shown.
For more information on using Customization Form, see Customization Form.
Example
The following sample code creates and assigns a context menu to the Customization Form each time it is shown. The assigned menu contains a single item used to clear the Customization Form’s content. The context menu is disposed of to release all the resources used.
The image below shows the result.
using DevExpress.XtraVerticalGrid.Rows;
//...
private void vGridControl1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {
if (e.Button == MouseButtons.Right) vGridControl1.CreateCustomization();
}
ContextMenu menu = null;
private void vGridControl1_ShowCustomizationForm(object sender, System.EventArgs e) {
menu = new ContextMenu(new MenuItem[] {new MenuItem("Clear")});
menu.MenuItems[0].Click += new EventHandler(menuItem1_Click);
vGridControl1.CustomizationForm.ContextMenu = menu;
}
private void vGridControl1_HideCustomizationForm(object sender, System.EventArgs e) {
if (menu == null) return;
menu.MenuItems[0].Click -= new EventHandler(menuItem1_Click);
menu.Dispose();
menu = null;
}
private void menuItem1_Click(object sender, System.EventArgs e) {
RowOperationVisible RowOperatVisible = new RowOperationVisible();
vGridControl1.RowsIterator.DoOperation(RowOperatVisible);
}
public class RowOperationVisible : RowOperation {
public RowOperationVisible() {}
public override void Execute(BaseRow row) {
if (row.Visible == false && row.OptionsRow.AllowMoveToCustomizationForm)
row.Visible = true;
}
}