ColumnBase.CustomColumnFilterPopupTemplate Property
Gets or sets the template that defines the presentation of the column’s Drop-down Filter. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v18.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
DataTemplate | A DataTemplate object that defines the presentation of a custom column filter. |
Remarks
If you don’t want to use built-in filter dropdowns (list or checked list), you can provide your own filter dropdown via templates. In this instance, you should do the following:
- Set the column’s ColumnBase.FilterPopupMode property to FilterPopupMode.Custom.
- Create a template representing the required filter dropdown and assign it to the CustomColumnFilterPopupTemplate property.
To create a custom drop-down filter:
- Set the column’s ColumnBase.FilterPopupMode property to FilterPopupMode.Custom.
- Create a template representing the required drop-down filter and assign it to the
ColumnBase.CustomColumnFilterPopupTemplate
property.
This example demonstrates how to create a custom drop-down filter for the Index column.
The image below shows the result:
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-create-a-custom-filter-dropdown-e1616.
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Markup;
using DevExpress.Data.Filtering;
namespace DXGrid_CustomFilterPopup {
public partial class Window1 : Window {
public Window1() {
InitializeComponent();
grid.ItemsSource = GridData.GetData();
}
}
public class GridData {
static public List<DataObject> GetData() {
List<DataObject> data = new List<DataObject>();
for (int i = 0; i < 100; i++)
data.Add(new DataObject() { Index = i });
return data;
}
}
public class DataObject {
public int Index { get; set; }
}
public class IntToCriteriaOperatorConverter : MarkupExtension, IValueConverter {
public override object ProvideValue(IServiceProvider serviceProvider) {
return this;
}
#region IValueConverter Members
object IValueConverter.Convert(object value, Type targetType,
object parameter, System.Globalization.CultureInfo culture) {
BinaryOperator op = value as BinaryOperator;
if (object.ReferenceEquals(op, null))
return null;
OperandValue operandValue = op.RightOperand as OperandValue;
return operandValue.Value;
}
object IValueConverter.ConvertBack(object value, Type targetType,
object parameter, System.Globalization.CultureInfo culture) {
return new BinaryOperator("Index", Convert.ToInt32(value), BinaryOperatorType.Greater);
}
#endregion
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomColumnFilterPopupTemplate 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.