Skip to main content

VGridControlBase.CustomizationFormDeletingCategory Event

Fires when a category is about to be deleted in Customization Form.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.1.dll

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


public event CustomizationFormDeletingCategoryEventHandler CustomizationFormDeletingCategory

Event Data

The CustomizationFormDeletingCategory event's data class is CustomizationFormDeletingCategoryEventArgs. The following properties provide information specific to this event:

Property Description
CanDelete Gets or sets a value specifying whether a row is allowed to be deleted.
Category Gets the processed category row. Inherited from CategoryEventArgs.


To delete a category in Customization Form , select the category in the Categories page and click Delete.

The CustomizationFormDeletingCategory event fires after Delete button is clicked and before the category is deleted.

The Category event parameter returns the category that is about to be deleted. Set the CanDelete event parameter to false to cancel the action.

When a user deletes a category, its rows are also deleted. The VGridControl.OptionsBehavior.PreserveChildRows property allows you to preserve the rows, and delete the category only. The preserved rows move to the root level.


This code below shows how to check whether the category that is about to be deleted contains a specific row. If the category contains the specified row, the code cancels the action and shows a notification.


using DevExpress.XtraVerticalGrid.Events;

private void vGridControl1_CustomizationFormDeletingCategory(object sender, 
CustomizationFormDeletingCategoryEventArgs e) {
    VGridControl vGridControl = sender as VGridControl;
    BaseRow iconRow = vGridControl.Rows["erPhoto"];
    if (iconRow == null) return;
    // Check whether the category contains the specified row.
    if (e.Category.HasAsChild(iconRow)) {
        string messageText = 
        "You cannot delete this category.";
        // Display a notification.
        MessageBox.Show(messageText,"Denied Operation");
        // Cancel the action.
        e.CanDelete = false;
See Also