ShowValueEditorEventArgs.CustomRepositoryItem Property
Allows you to specify a custom editor to be opened instead of the default one, specified by the Editor property.
Namespace: DevExpress.XtraEditors.Filtering
Assembly: DevExpress.XtraEditors.v19.2.dll
Declaration
Property Value
Type | Description |
---|---|
RepositoryItem | A RepositoryItem descendant identifying the custom editor that will be created and displayed instead of the default one. |
Remarks
To provide a custom editor instead of the default editor, create a corresponding descendant of the RepositoryItem class and assign it to the CustomRepositoryItem property.
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-provide-custom-editors-to-edit-value-operands-in-the-filtercontrol-e1519
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;
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomRepositoryItem property.
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.