Skip to main content

DxDataGrid<T>.MultipleSelectedDataRowsChanged Event

Occurs when a user changed selection in multiple selection mode.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[Parameter]
public Action<IEnumerable<T>> MultipleSelectedDataRowsChanged { get; set; }

Parameters

Type Description
IEnumerable<T>

The selected data rows.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Handle the MultipleSelectedDataRowsChanged event to track selection changes in multiple selection mode.

Note

Set the SelectionMode property to OptimizedMultipleSelection to allow users to select multiple rows in the grid.

<DxDataGrid Data="@DataSource"
    SelectionMode="DataGridSelectionMode.MultipleSelectedDataRows"
    MultipleSelectedDataRows="@SelectedProducts"
    MultipleSelectedDataRowsChanged="@OnSelectedProductsChanged">
    ...
</DxDataGrid>

@code {
    IEnumerable<Product> DataSource;
    IEnumerable<Product> SelectedProducts { get; set; }

    protected void OnSelectedProductsChanged(IEnumerable<ProductFlat> products) {
        SelectedProducts = products;
        ...
    }

    protected override void OnInitialized() {
        ...
        SelectedProducts = DataSource.Take(2);
    }
}

Another way to implement this task is to use the two-way synchronization.

<DxDataGrid Data="@DataSource"
    SelectionMode="DataGridSelectionMode.MultipleSelectedDataRows"
    @bind-MultipleSelectedDataRows="@SelectedProducts">
    ...
</DxDataGrid>

@code {
    IEnumerable<ProductFlat> selectedProducts;
    IEnumerable<ProductFlat> SelectedProducts {
        get { return selectedProducts; }
        set {
            selectedProducts = value;
            ...
        }
    }
}

Online Demo

Data Grid - Multiple Data Rows Selection

See Also