Skip to main content

VGridControl.CustomFilterDisplayText Event

Allows you to customize the display text representing the current filter within the filter panel.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v23.2.dll

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

Declaration

public event ConvertEditValueEventHandler CustomFilterDisplayText

Event Data

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

Property Description
Handled Gets or sets a value specifying whether default edit value conversion/formatting is required.
Value Gets or sets either the edit or the display value of an editor.

Remarks

The CustomFilterDisplayText event allows you to customize the display text of a specific filter (generally, the text displayed within the filter panel). When the event fires, its Value parameter specifies the current filter criteria which is represented by a CriteriaOperator object. Depending on the current criteria, you can provide a specific filter display text. To specify the filter display text, assign the required string (or any object whose ToString() method returns the required string) to the Value parameter and set the Handled parameter to true.

Example

In the following example, the VGridControl.CustomFilterDisplayText event is handled to display “No Filter” in the filter panel when the control’s data is not filtered.

If the control’s data is not filtered, the ConvertEditValueEventArgs.Value event parameter is set to null (Nothing in VB). In this instance, the custom display text that needs to be displayed in the filter panel is assigned to this parameter.

If the control’s data is filtered, the ConvertEditValueEventArgs.Value event parameter specifies a valid CriteriaOperator object, which represents the current data filter. In this instance, the example illustrating the textual representation of the current filter is assigned to the ConvertEditValueEventArgs.Value parameter. Alternatively, you can check the current CriteriaOperator object to provide custom display text depending upon the current filter.

The result for a sample vertical grid control is displayed below.

VGridControl_CustomFilterDisplayText_Event

Note

The VGridOptionsView.ShowFilterPanelMode setting of the control’s VGridControlBase.OptionsView should be set to ShowAlways to enable the filter panel to be displayed even if no data filter is currently applied.

private void vGridControl1_CustomFilterDisplayText(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e) {
    if (e.Value == null) {
        e.Value = "No Filter";
    }
    else {
        e.Value = e.Value.ToString();
    }
    e.Handled = true;
}
See Also