Skip to main content

FilterControl Class

Represents a Filter Control.

Namespace: DevExpress.Xpf.Editors.Filtering

Assembly: DevExpress.Xpf.Core.v14.2.dll

#Declaration

public class FilterControl :
    Control,
    IDialogContent

#Remarks

The FilterControl is a visual control that allows end-users to construct complex filter criteria, and apply them to controls or to a data source.

FilterControl_UI

The FilterControl can control data filtering for the DXGrid control, and any object which implements the DevExpress.Xpf.Editors.Filtering.IFilteredComponent interface. To specify the object to which the grid will supply filter criteria, use the FilterControl.SourceControl property.

NOTE

Note that although the DXGrid control provides an embedded Filter Editor, you can still use a separate FilterControl, with the DXGrid control to provide standalone filter editing.

After a source control has been assigned to the FilterControl via the FilterControl.SourceControl property, the filter columns and editors used to edit operand values are automatically retrieved from the source control. Filter columns are stored within the FilterControl.FilterColumns collection.

The filter expression built via the FilterControl can be obtained via the FilterControl.FilterCriteria property. This property can also be used to specify filter criteria in code.

To apply a filter created in the FilterControl to the grid control using the FilterControl.ApplyFilter method, use binding for the FilterControl.FilterCriteria property, as shown in the code snippet below.


<dxe:FilterControl x:Name="filterEditor" SourceControl="{Binding ElementName=filterGrid, Path=FilteredComponent}"
                               FilterCriteria="{Binding ElementName=filterGrid, Path=FilterCriteria, Mode=TwoWay}"/>

Changes made to the source control's filter criteria are automatically tracked by the FilterControl. Each time the source control's filtering settings are modified by a user or in code, the FilterControl automatically reflects the changes. Note that filter criteria built via the FilterControl are not automatically applied to the bound source control. To apply the current filter criteria to the source control, use the FilterControl.ApplyFilter method.

The FilterControl can be used in unbound mode, when it's not bound to any source control (the FilterControl.SourceControl property is set to null). In this mode, specific columns must be added to the FilterControl.FilterColumns collection manually. An end-user will be able to construct filter criteria using these columns. To get the current filter criteria, use the FilterControl.FilterCriteria property.

See Also