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.

bug: UI Theme Changing is Broken if there is a <Carousel />

See original GitHub issue

Describe the bug

After bumping Avalonia version from 0.9.12 to 0.10.0 theme changing via window.Styles[0] = new StyleInclude is no longer working properly. E.g. every second time I change the theme, the theme is applied correctly but then someone is resetting the styles, see the GIF below:

ezgif-7-caa9cbcc48e9

Update (28.02.2021)

The errors seem to be coming from the <Carousel /> control. Theme changing works perfectly if I remove the <Carousel />, see https://github.com/AvaloniaUI/Avalonia/issues/5530#issuecomment-787417903 Also a <Carousel /> occasionally throws a KeyNotFoundException, see https://github.com/AvaloniaUI/Avalonia/issues/5530#issuecomment-787050397

To Reproduce

Here is the repro. Steps to reproduce the behavior:

  1. git clone https://github.com/worldbeater/Camelotia.git
  2. git checkout updates (a branch with Avalonia 0.10.0)
  3. Launch src/Camelotia.Avalonia.sln or do cd src/Camelotia.Presentation.Avalonia && dotnet run
  4. Press Switch Theme multiple times

On master (Avalonia 0.9.12) theme changing works fine, on updates (Avalonia 0.10.0) theme changing is broken.

Expected behavior

Theme changing at runtime worked perfectly on Avalonia 0.9.12, so I guess it should work on Avalonia 0.10.0? Or, probably there is a workaround that could help prevent the style resetting after doing _window.Styles[0] = new StyleInclude? Currently using this class and avares for theme loading. Possibly related https://github.com/AvaloniaUI/Avalonia/issues/5509

Desktop (please complete the following information):

  • OS: Ubuntu KDE
  • Version 18.04 LTS

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
worldbeatercommented, Apr 2, 2021

Ideally we should somehow debug and fix this on Avalonia side. The issue seems to arise due to a missing key in the dict https://github.com/AvaloniaUI/Avalonia/blob/554aaec5e5cc96c0b4318b6ed1fbf8159f442889/src/Avalonia.Controls/Generators/ItemContainerGenerator.cs#L65-L78

2reactions
Shidesucommented, Apr 2, 2021

Yeah that’s what I think. I removed my PageSlide transition and can’t make it crash now. I suppose this should also fix it for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: UI Theme Changing is Broken if there is a <Carousel />
Describe the bug. After bumping Avalonia version from 0.9.12 to 0.10.0 theme changing via window.Styles[0] = new StyleInclude is no longer ...
Read more >
OutSystems 10 Carousel is BROKEN
I found that for some UI Themes it doesn't work. However: It's quite the challenge to change from London to Lisbon theme when...
Read more >
CarouselView doesn't scroll to the CurrentItem when set
This updates the UI, so the user sees the correct thing, however the scroll mechanics of the carousel are broken as some parts...
Read more >
Having issues with Elementor Image carousel on mobile
I'm having a responsive issue with the image carousel widget by elementor. The problem is that the carousel is not adjusting to the...
Read more >
react-slick: Import CSS from slick-carousel fails
I was struggling with this issue and I finally find the solution: just go inside of your node_modules folder and find slick-carousel folder. ......
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