question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CarouselView Renders Duplicate Data Templates Multiple Times

See original GitHub issue

Description

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

  1. Clone maui-samples
  2. Run the carousel demo at https://github.com/dotnet/maui-samples/tree/main/6.0/UserInterface/Views/CarouselViewDemos
  3. Select Horizontal Data Template
  4. 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:open
  • Created 10 months ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bcaceirocommented, Nov 23, 2022

I have the same problem.

1reaction
jinxinjuancommented, Jun 28, 2023

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found