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.1.dll
NuGet Package: DevExpress.Blazor
Declaration
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
MakeDataItemVisibleAsync(TData)
See Also