Skip to main content
All docs
V23.2

FilterControl.CustomValueEditor Event

Allows you to assign a custom editor used to display and edit an operand.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event EventHandler<CustomValueEditorArgs> CustomValueEditor

Event Data

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

Property Description
ElementIndex
Node
Operation
PropertyName Gets the name of the current property (column/field). Inherited from BaseNodeEventArgs.
PropertyType Gets the type of the current property (column/field). Inherited from BaseNodeEventArgs.
RepositoryItem
Value

Remarks

The CustomValueEditor event fires before the Filter Control displays a value operand. Handle this event to specify a custom editor used to display and edit the operand. For this purpose, create a corresponding repository item (a RepositoryItem descendant) and assign it to the RepositoryItem event parameter.

The FilterControl.CustomValueEditorForEditing event allows you to specify an editor that is only used to edit an operand.

Example

This example handles the FilterControl.CustomValueEditor event to assign custom editors (Spin Editor and Calc Editor) to value operands in Data Grid’s embedded FilterControl.

The Data Grid’s ColumnView.FilterEditorCreated event is used to subscribe to the FilterControl.CustomValueEditor event.

FilterControl-CustomValueEditor

private void gridView1_FilterEditorCreated(object sender, FilterControlEventArgs e) {
    e.FilterEditor.CustomValueEditor += FilterEditor_CustomValueEditor;
}

readonly RepositoryItemSpinEdit spinEdit = new RepositoryItemSpinEdit();
readonly RepositoryItemCalcEdit calcEdit = new RepositoryItemCalcEdit();

private void FilterEditor_CustomValueEditor(object sender, CustomValueEditorArgs e) {
    if (e.Node.FirstOperand.PropertyName != "Payment") return;
    RepositoryItemTextEdit item = null;
    if (e.ElementIndex == 2)
        item = spinEdit;
    else
        item = calcEdit;
    var settings = item.MaskSettings.Configure<MaskSettings.Numeric>();
    settings.MaskExpression = "c";
    e.RepositoryItem = item;
}
See Also