DXGrid has the built-in ShowAllTableValuesInCheckedFilterPopup property that allows enabling the following mode:
- If the current column is not filtered, the filter dropdown displays only those items that meet the grid's filter condition.
- Otherwise, all data source items are displayed to simplify the process of grid filter correction.
If this functionality is insufficient, and filtering dropdown items when the current column is filtered is required, use the approach demonstrated in this example.
Dropdown items can be filtered in the DataViewBase.ShowFilterPopup event handler. To maintain items that were filtered by the current column and remove items filtered by other grid columns, perform the following steps:
1. Exclude the current column from the grid's filter. For thisuse the ClearColumnFilter method.
2. Filter items with the resulting filter criteria using our internal ExpressionEvaluator class.
[C#]ExpressionEvaluatorevaluator=newExpressionEvaluator(TypeDescriptor.GetProperties(source.FirstOrDefault()),criteria);IEnumerable<object>filteredCollection=evaluator.Filter(source).OfType<object>();
3. From the e.ComboBoxEdit.ItemsSource collection, remove all items except special items and add items that meet the filter condition.