Back to Devexpress

DataViewBase.FilterEditorTemplate Property

wpf-devexpress-dot-xpf-dot-grid-dot-dataviewbase-8c3fad42.md

latest3.2 KB
Original Source

DataViewBase.FilterEditorTemplate Property

Gets or sets a template that defines the presentation of the Filter Editor. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public DataTemplate FilterEditorTemplate { get; set; }
vb
Public Property FilterEditorTemplate As DataTemplate

Property Value

TypeDescription
DataTemplate

A template that defines the presentation of the Filter Editor.

|

Remarks

Run Demo: Filter Editor - Customize the Field List

The following code sample shows how to add the ShipCountry , ShipCity , ShipAddress fields to the Ship category:

xaml
<dxg:TableView x:Name="view">
    <dxg:TableView.FilterEditorTemplate>
        <DataTemplate>
            <dxfui:FilterEditorControl QueryFields="OnQueryFields" />
        </DataTemplate>
    </dxg:TableView.FilterEditorTemplate>
</dxg:TableView>
csharp
void OnQueryFields(object sender, QueryFieldsEventArgs e) {
    var shipCountry = e.Fields["ShipCountry"];
    var shipCity = e.Fields["ShipCity"];
    var shipAddress = e.Fields["ShipAddress"];

    shipCountry.Caption = "Country";
    shipCity.Caption = "City";
    shipAddress.Caption = "Address";

    e.Fields.Remove(shipCountry);
    e.Fields.Remove(shipCity);
    e.Fields.Remove(shipAddress);

    var shipGroup = new FieldItem { Caption = "Ship" };
    shipGroup.Children.Add(shipCountry);
    shipGroup.Children.Add(shipCity);
    shipGroup.Children.Add(shipAddress);
    e.Fields.Add(shipGroup);
}
vb
Private Sub OnQueryFields(ByVal sender As Object, ByVal e As QueryFieldsEventArgs)
    Dim shipCountry = e.Fields("ShipCountry")
    Dim shipCity = e.Fields("ShipCity")
    Dim shipAddress = e.Fields("ShipAddress")

    shipCountry.Caption = "Country"
    shipCity.Caption = "City"
    shipAddress.Caption = "Address"

    e.Fields.Remove(shipCountry)
    e.Fields.Remove(shipCity)
    e.Fields.Remove(shipAddress)

    Dim shipGroup = New FieldItem With {
        .Caption = "Ship"
    }
    shipGroup.Children.Add(shipCountry)
    shipGroup.Children.Add(shipCity)
    shipGroup.Children.Add(shipAddress)
    e.Fields.Add(shipGroup)
End Sub

See Also

DataViewBase Class

DataViewBase Members

DevExpress.Xpf.Grid Namespace