Share via

CarouselView CurrentItemChanged is called as many times as there are item on load

Lloyd Sheen 1,491 Reputation points
2023-07-11T16:12:39.64+00:00

As in the title the event is called multiple times and make the event pretty much useless to use. I have just a simple example with just an array of strings. The event is called the number of times corresponding to the number of strings.

XAML: definition

<StackLayout Margin="10" Grid.Row="0" Grid.RowSpan="4">
            <CarouselView CurrentItemChanged="currentItemChanged">
                <CarouselView.ItemsSource>
                    <x:Array Type="{x:Type sys:String}">
                        <sys:String>Page 1</sys:String>
                        <sys:String>Page 2</sys:String>
                        <sys:String>Page 3</sys:String>
                    </x:Array>
                </CarouselView.ItemsSource>

                <CarouselView.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Label Text="{Binding .}" HorizontalOptions="Center" />
                        </Grid>
                    </DataTemplate>
                </CarouselView.ItemTemplate>
            </CarouselView>
        </StackLayout>
Developer technologies | .NET | .NET Multi-platform App UI

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,166 Reputation points Microsoft External Staff
    2024-06-10T02:38:31.17+00:00

    Hello,

    Thanks for your feedback.

    Q&A is not a bug reporting or tracking system. If you think you've found a bug in Maui please report it in the Maui github repository at maui issues . We will clear details to be able to reproduce and troubleshoot the problem. When you post it, please include version numbers, exact repro steps, and the difference between the expected behaviour and actual behaviour.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.