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

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

C#
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:

Carousel - Slide to Specific Item

<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