Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

VGridControl.CustomRecordFilter Event

Allows you to hide a record regardless of the applied filter.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

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

#Declaration

public event CustomRecordFilterEventHandler CustomRecordFilter

#Event Data

The CustomRecordFilter event's data class is DevExpress.XtraVerticalGrid.Events.CustomRecordFilterEventArgs.

#Remarks

The CustomRecordFilter event fires when a new filter is applied. The event allows you to hide a record regardless of the applied filter.

Read the RecordIndex event parameter to get the processed record’s zero-based index in the underlying data source. The IsFitDefaultFilter parameter returns whether the record fits the applied filter. Set the Handled parameter to true to hide the record.

The code snippet below shows how to hide all records where City row contains Berlin.

private void vGridControl1_CustomRecordFilter(object sender, DevExpress.XtraVerticalGrid.Events.CustomRecordFilterEventArgs e) {
    DevExpress.XtraVerticalGrid.VGridControl grid = sender as DevExpress.XtraVerticalGrid.VGridControl;
    if (sender == null) return;
    DataRowView dataRowView = grid.GetRecordObject(e.RecordIndex) as DataRowView;
    if (dataRowView == null) return;
    if (dataRowView.Row["City"] as String == "Berlin") e.Handled = true;         
}
See Also