Relative Content

Tag Archive for xamlmauicarouselcurrentitem

How do i change the CurrentItem in a CarouselView?

I am fairly new to MAUI Apps and what i have is a CarouselView bound to a collection of students. Everything is working fine, however i have an issue which appears to be widespread – I have a Next and Previous button which i want to use to navigate from one item in the carousel to the next. The Previous button works fine, however the Next button doesn’t behave as expected. If I have, for example, 3 students in my collection, I cannot smoothly navigate from Student 1 (position 0) to Student 2 (position 1). I have to click the next button twice and it’s only on the 3rd click that it finally moves to student 2. It keeps resetting back to student 1. I monitored the behavior in Debug mode and I can see that the current Item in the preview does indeed change when I debug the NextButton_Clicked method, but as soon as the debug exits the method, the CurrentItem resets back to student 1 (position 0). As I mentioned, my Students collection is working fine and the data is as expected and I do not have any other (visible) triggers that may be overriding the CurrentItem change. For reference, my methods in the code-behind are below;