Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxListBox<TData, TValue>.MakeDataItemVisibleAsync(TData) Method

Makes the row bound to the specified data item visible on screen.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public Task MakeDataItemVisibleAsync(
    TData dataItem
)

#Parameters

Name Type Description
dataItem TData

A data item.

#Returns

Type Description
Task

The task that is completed when the row becomes visible.

#Remarks

Pass a data item to the MakeDataItemVisibleAsync method to make the corresponding row visible on screen. The method scrolls the item list up or down until the row appears.

The MakeDataItemVisibleAsync method does nothing if no row corresponds to the passed data item.

The following example navigates to the selected data row:

<DxListBox Data="@Staff.DataSource"
           @ref="MyListBox"
           @bind-Value="@SelectedDataItem"
           SelectionMode="ListBoxSelectionMode.Single"
           TextFieldName="@nameof(Person.Text)">
</DxListBox>

<DxButton Text="Go to the selected item" Click="ScrollToFirstSelectedItemAsync" />

@code {
    IListBox<Person, Person> MyListBox; 
    IEnumerable<Person> Values { get; set; } = Staff.DataSource.Take(1);
    Person SelectedDataItem { get; set; }

    async Task ScrollToFirstSelectedItemAsync() {
        if (SelectedDataItem != null)
            await MyListBox.MakeDataItemVisibleAsync(SelectedDataItem);
    }
}

#Implements

See Also