Skip to main content
All docs
V24.1

DxListBox<TData, TValue>.GetFilterCriteria() Method

Returns the filter criteria applied to List Box data.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public CriteriaOperator GetFilterCriteria()

Returns

Type Description
CriteriaOperator

An object that specifies the filter expression.

Remarks

You can use the SetFilterCriteria(CriteriaOperator) method to apply filter criteria to List Box data. To get the applied filter criteria, use the GetFilterCriteria method.

<DxToolbar ItemClick="@OnItemClick">
    <Items>
        <DxToolbarItem Name="_setFilterCriteria" Text="Set Filter Criteria" Tooltip="Set Filter Criteria" />
        <DxToolbarItem Name="_clearFilterCriteria" Text="Clear Filter Criteria" Tooltip="Clear Filter Criteria" />
    </Items>
</DxToolbar>
<br/>
<DxListBox @ref="@_listBox" TData=Person TValue=Person Data="Staff.DataSource"
            ShowCheckboxes="true"
            SelectionMode="@ListBoxSelectionMode.Multiple">
    <Columns>
        <DxListEditorColumn FieldName="FirstName"></DxListEditorColumn>
        <DxListEditorColumn FieldName="LastName"></DxListEditorColumn>
        <DxListEditorColumn FieldName="Department"></DxListEditorColumn>
        <DxListEditorColumn FieldName="Salary"></DxListEditorColumn>
    </Columns>
</DxListBox>
<p class="cw-480 mt-3">
    Filter Criteria: <b>@_listBox?.GetFilterCriteria().ToString()</b>
</p>

@code {
    IListBox<Person, Person> _listBox;
    void OnItemClick(ToolbarItemClickEventArgs e) {
        switch(e.ItemName) {
            case "_setFilterCriteria":
                _listBox.SetFilterCriteria(new BinaryOperator(nameof(Person.Salary), 2000, BinaryOperatorType.Greater));
                break;
            case "_clearFilterCriteria":
                _listBox.ClearFilter();
                break;
        }
    }
}

Filter Criteria

Implements

See Also