DxCarousel.SlideToItemAsync(Int32) Method
Navigates to the Carousel item with the specified index.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public Task SlideToItemAsync(
int index
)
Parameters
Name | Type | Description |
---|---|---|
index | Int32 | The Carousel item index. |
Returns
Type | Description |
---|---|
Task | The task that is completed when the specified Carousel item is activated. |
Remarks
Call the SlideToItemAsync
method to navigate to the Carousel item with the specified index programmatically.
The following code snippet navigates to the first item in the gallery on a custom button click:
<DxCarousel Width="500px"
Height="300px"
@ref="carousel"
Data="@GetCarouselData()"
LoopNavigationEnabled="true"
ImageSizeMode="CarouselImageSizeMode.FillAndCrop">
</DxCarousel>
<DxButton Text="First Item" Click="MoveToFirst" />
@code {
DxCarousel carousel;
async Task MoveToFirst (MouseEventArgs args) {
await carousel.SlideToItemAsync(0);
}
}
See Also