How to: Customize Filter Items within a Column's Filter Dropdown

  • 3 minutes to read

This example shows how to replace the Date column's drop-down filter items with custom items:

  • (All) - Cancels filtering
  • Registered in 2008 - Shows users that were registered in 2008
  • Registered in 2009 - Shows users that were registered in 2009

The image below shows the result:

exCustomizeFilterDropdown

View Example: How to customize filter items within a column's Filter Dropdown

<Window x:Class="DXGrid_CustomizingFilterDropdown.Window1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
        Title="Window1" Height="300" Width="535">
    <Grid>

        <dxg:GridControl x:Name="grid" ItemsSource="{Binding AccountList}">
            <dxg:GridControl.Columns>
                <dxg:GridColumn FieldName="UserName"/>
                <dxg:GridColumn FieldName="RegistrationDate" FilterPopupMode="List"/>
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:TableView AutoWidth="True" ShowFilterPopup="TableView_ShowFilterPopup" />
            </dxg:GridControl.View>
        </dxg:GridControl>
    </Grid>
</Window>