Back to Devexpress

VGridControlBase.CustomizationForm Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrolbase-141916be.md

latest5.5 KB
Original Source

VGridControlBase.CustomizationForm Property

Provides access to the Customization Form.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
[Browsable(false)]
public VGridCustomizationFormBase CustomizationForm { get; }
vb
<Browsable(False)>
Public ReadOnly Property CustomizationForm As VGridCustomizationFormBase

Property Value

Type
DevExpress.XtraVerticalGrid.Rows.VGridCustomizationFormBase

Remarks

The Customization Form allows end-users to hide rows and make them visible again. Use the CustomizationForm property to adjust the 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.

Refer to the following help topic for more information: Customization Form - Vertical Grid.

Example

The following sample assigns a context menu to the Customization Form each time it is shown. The context menu contains a single item used to restore hidden rows.

csharp
using DevExpress.XtraVerticalGrid.Rows;
//...

private void btnShowCustomizationForm_Click(object sender, EventArgs e) {
   // Show Customization Form.
    vGridControl1.ShowCustomization();
}

ContextMenu menu = null;
private void vGridControl1_ShowCustomizationForm(object sender, System.EventArgs e) {
   menu = new ContextMenu(new MenuItem[] {new MenuItem("Restore All")});
   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;
   }
}
vb
Imports DevExpress.XtraVerticalGrid.Rows
' ...

Private Sub BtnShowCustomizationForm_Click(sender As Object, e As EventArgs) Handles BtnShowCustomizationForm.Click
    ' Show Customization Form.
    VGridControl1.ShowCustomization()
End Sub

Dim _menu As ContextMenu = Nothing
Private Sub VGridControl1_ShowCustomizationForm(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles VGridControl1.ShowCustomizationForm
   _menu = New ContextMenu(New MenuItem() {New MenuItem("Restore All")})
   AddHandler _menu.MenuItems(0).Click, New EventHandler(AddressOf menuItem1_Click)
   VGridControl1.CustomizationForm.ContextMenu = _menu
End Sub

Private Sub VGridControl1_HideCustomizationForm(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles VGridControl1.HideCustomizationForm
   If _menu Is Nothing Then
      Exit Sub
   End If
   RemoveHandler _menu.MenuItems(0).Click, New EventHandler(AddressOf menuItem1_Click)
   _menu.Dispose()
   _menu = Nothing
End Sub

Private Sub menuItem1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
   Dim RowOperatVisible As RowOperationVisible = New RowOperationVisible()
   VGridControl1.RowsIterator.DoOperation(RowOperatVisible)
End Sub

Public Class RowOperationVisible
   Inherits RowOperation
   Public Sub New()
   End Sub

   Public Overrides Sub Execute(ByVal row As BaseRow)
      If row.Visible = False And row.OptionsRow.AllowMoveToCustomizationForm Then
         row.Visible = True
      End If
   End Sub
End Class

See Also

ShowCustomizationForm

HideCustomizationForm

ShowCustomization

VGridControlBase Class

VGridControlBase Members

DevExpress.XtraVerticalGrid Namespace