AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
710 stars 114 forks source link

ItemDisappearing giving me this error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" #405

Closed brettnguyen closed 2 years ago

brettnguyen commented 2 years ago

ItemDisappearing giving me this error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" specifically using the mediaelement from the community toolkit like this in my .cs page "mediaElements[args.Index].Pause();".

links to my xaml and xaml.cs

https://github.com/brettnguyen/CollegeVSDemo/blob/master/CollegeVS/CollegeVS/Views/HomePages/CLGVSHome.xaml

https://github.com/brettnguyen/CollegeVSDemo/blob/master/CollegeVS/CollegeVS/Views/HomePages/CLGVSHome.xaml.cs

AndreiMisiukevich commented 2 years ago

I see that ItemsSource is bound to highlights ItemsSource="{Binding highlights}"

But you call pause on mediaElements.

It is most probably an error in your code.

Make sure that you you get an appropriate item from mediaelements collection for stopping it