Skip to main content
All docs
V24.2

DxTreeList.PageSizeChanged Event

Fires when the page size changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<int> PageSizeChanged { get; set; }

Parameters

Type Description
Int32

A new PageSize property value.

Remarks

The PageSizeChanged event fires each time the PageSize property value changes. The event is handled automatically when you use two-way data binding for the PageSize property (@bind-PageSize).

You can also handle this event to create a custom response to page size changes.

The following example displays an informational message when a user selects a new value in the page size selector:

@inject EmployeeTaskService EmployeeTaskService

<div><b>@PageSizeInfo</b></div>

<DxTreeList Data="TreeListData"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId"
            PageSize="@PageSize"
            PageSizeSelectorVisible="true"
            PageSizeSelectorItems="@(new int[] { 5, 10, 15 })"
            PageSizeChanged="OnPageSizeChanged">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>


@code {
    List<EmployeeTask> TreeListData { get; set; }
    int PageSize { get; set; } = 10;
    string PageSizeInfo { get; set; } = "Page size is 10";

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
    void OnPageSizeChanged(int newPageSize) {
        PageSizeInfo = "Page size was changed from " + PageSize + " to " + newPageSize;
        PageSize = newPageSize;
    }
}

Blazor TreeList Page Size Changed

For more information about paging in the TreeList component, refer to the following topic: Paging in Blazor TreeList.

See Also