How to: Display a Custom String in the Filter Panel when a View's Data is not Filtered

In the following example the ColumnView.CustomFilterDisplayText event is handled to display the "No Filter" string in the filter panel when a View's data is not filtered.

If a View's data is not filtered the event's Value parameter is set to null. In this instance, the custom display text that needs to be displayed in the filter panel is assigned to this parameter. If the View is filtered, the Value parameter specifies a valid CriteriaOperator object, which represents the current filter criteria. In this instance, the example illustrates the textual representation of the current filter is assigned to the 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 grid control is displayed below:

ColumnView.CustomFilterDisplayText_ex

private void gridView1_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;            
}