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

ColumnView.FilterEditorCreated Event

Allows you to customize the Filter Editor before it is displayed on screen.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v19.2.dll

Declaration

[DXCategory("Behavior")]
public event FilterControlEventHandler FilterEditorCreated

Event Data

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

Property Description
Context Provides access to the ExpressionEditorContext object, which allows you to customize the FilterEditorControl‘s “Text” tab. Inherited from BaseFilterControlEventArgs.
FilterBuilder Gets the form that displays the Filter Control.
FilterControl Gets the Filter Control that displays filter criteria. This property returns null if the ColumnViewOptionsFilter.DefaultFilterEditorView property is set to any value except Visual.
FilterEditor Gets the FilterControl (in Visual view mode) or embedded FilterControl (in VisualText, TextVisual and Text view modes). Inherited from BaseFilterControlEventArgs.
FilterEditorForm Inherited from BaseFilterControlEventArgs.
IFilterControl Gets the Filter Control that displays filter criteria.
IFilterEditor Provides access to the currently used Filter Control (FilterControl or FilterEditorControl) via an interface. Inherited from BaseFilterControlEventArgs.
ShowFilterEditor Gets or sets whether to display the Filter Editor (the form that embeds the Filter Editor). Inherited from BaseFilterControlEventArgs.

Remarks

Use the FilterEditorCreated event to customize the Filter Editor, or prevent it from being displayed. The event fires each time the Filter Editor is to be displayed on screen.

Example

In this example, custom editors are provided to edit value operands in the FilterControl.

The custom editors (SpinEdit and CalcEdit) are supplied by handling the BeforeShowValueEditor event. To supply the editors, corresponding repository items are created and assigned to the event's CustomRepositoryItem parameter.In the example, the FilterControl is used within a GridControl. To get access and subscribe to the FilterControl's BeforeShowValueEditor event, the GridView.FilterEditorCreated event is handled.

The following image shows the result.

FilterControl_CustomValueEditor_ex

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

        void FilterControl_BeforeShowValueEditor(object sender, ShowValueEditorEventArgs e) {
            if(e.CurrentNode.FirstOperand.PropertyName != "Payment") return;
            RepositoryItemTextEdit item = null;
            if(e.FocusedElementIndex == 2)
                item = new RepositoryItemSpinEdit();
            else
                item = new RepositoryItemCalcEdit();
            item.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
            item.Mask.EditMask = "c";
            e.CustomRepositoryItem = item;
        }

The following code snippets (auto-collected from DevExpress Examples) contain references to the FilterEditorCreated event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also