Search code examples
carouselmudblazor

Usage of MudCarousel SelectedIndex property


I would set SelectedIndex pf MudCarousel to the last item when page displayed in the first time but it always display the first item or it doesen't work as the example shows: example I tried using the MoveTo(_source.Count - 1) method, but the carousel still doesn't load when the page is opened.


Solution

  • You can set the value of the SelectedIndex in OnInitialized

    protected override void OnInitialized()
    {
        selectedIndex = _source.Count() - 1;
    }
    

    MudBlazor snippet