Skip to main content
A newer version of this page is available. .

How to: Customize Operand Editor Properties in FilterControl

The following code shows how to handle the FilterControl.BeforeShowValueEditor event for a FilterControl being used in the Grid Control. This event fires when an editor used to edit an operand value is invoked. In the example, the editor’s foreground color is modified.

To subscribe to the FilterControl.BeforeShowValueEditor event when using the FilterControl within the Grid Control, the ColumnView.FilterEditorCreated event is handled.

using DevExpress.XtraEditors.Filtering;
using DevExpress.XtraGrid.Views.Base;

private void gridView1_FilterEditorCreated(object sender, FilterControlEventArgs e) {
    e.FilterControl.BeforeShowValueEditor += 
        new ShowValueEditorEventHandler(FilterControl_BeforeShowValueEditor);
}

void FilterControl_BeforeShowValueEditor(object sender, ShowValueEditorEventArgs e) {
    // Set the foreground color to Red
    e.Editor.Properties.Appearance.ForeColor = Color.Red;
}