CarouselView Renders Duplicate Data Templates Multiple Times
See original GitHub issueDescription
When running the Maui Samples, the CarouselView renders Monkey instances multiple times. In MonkeysViewModel.CreateMoneyCollection the code is loading 17 Monkey objects into Monkeys, an ObservableCollection of Monkey. However, the CarouselView is showing many more items than 17, duplicating the original 17 multiple times. Here’s the URL to the solution in the maui-samples repository:
https://github.com/dotnet/maui-samples/tree/main/6.0/UserInterface/Views/CarouselViewDemos
I ran into this problem with my code and verified that it reproduces with the maui-samples solution too.
Steps to Reproduce
- Clone
maui-samples - Run the carousel demo at https://github.com/dotnet/maui-samples/tree/main/6.0/UserInterface/Views/CarouselViewDemos
- Select Horizontal Data Template
- Observe the duplicated templates.
Link to public reproduction project repository
https://github.com/dotnet/maui-samples/tree/main/6.0/UserInterface/Views/CarouselViewDemos
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
10.0.17763.0
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Template inheritance - how to resolve duplicate usage
A solid option is to build components that have a data source item rather than relying purely on fields defined on the page....
Read more >Previous user input persists when DataTemplateSelector ...
Previous user input persists when DataTemplateSelector returns the same template multiple times ; DataTemplateSelector { public DataTemplate ...
Read more >How to use the same section multiple times on ...
Hello everyone! I'm new to customizing shopify themes and I'm trying to do the following. I want to add new sections on my...
Read more >Populate a CarouselView with data - .NET MAUI
A .NET MAUI CarouselView is populated with data by setting its ItemsSource property to any collection that implements IEnumerable.
Read more >3 Ways to Implement a Carousel in Next.js
Carousels improve visual experiences by highlighting a product, service, or value proposition. Read 3 ways to add a carousel to our Next.js ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have the same problem.
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on Windows and android platform with sample project. CarouselViewDemos