Back to Devexpress

DxListBox<TData, TValue>.DeselectAllAsync() Method

blazor-devexpress-dot-blazor-dot-dxlistbox-2-eefe65aa.md

latest2.4 KB
Original Source

DxListBox<TData, TValue>.DeselectAllAsync() Method

Deselects all available items in the List Box.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public Task DeselectAllAsync()

Returns

TypeDescription
Task

The task that is completed when all available items are deselected.

|

Remarks

Call the DeselectAllAsync method to clear all selectable List Box items. This method does not affect items hidden by a filter or disabled items.

To select all items, call the SelectAllAsync() method.

To access selected items, implement two-way binding for the Values property or handle the SelectedDataItemsChanged event.

razor
<DxButton Click="SelectAll">Select All Items</DxButton>
<DxButton Click="DeselectAll">Deselect All Items</DxButton>

<DxListBox Data="@Staff.DataSource"
           @ref=MyListBox
           TextFieldName="@nameof(Person.Text)"
           SelectionMode="ListBoxSelectionMode.Multiple"
           ShowCheckboxes="true"
           ShowSelectAllCheckbox="true"
           @bind-Values="@Values">
</DxListBox>

@code {
    IListBox<Person,Person> MyListBox { get; set; }
    IEnumerable<Person> Values { get; set; }

    async Task SelectAll(MouseEventArgs args) {
        await MyListBox.SelectAllAsync();
    }
    async Task DeselectAll(MouseEventArgs args) {
        await MyListBox.DeselectAllAsync();
    }
}

Implements

DeselectAllAsync()

See Also

DxListBox<TData, TValue> Class

DxListBox<TData, TValue> Members

DevExpress.Blazor Namespace