Skip to content

[Chefs] [Skia] Changing theme colors text and images incorrectly #20905

Closed

Description

@ramezgerges

Current behavior 🐛

If you change the theme of the Chefs app on any page past the welcome page, the colors aren't adjusted correctly. Specifically, the text remains the same and the image colors are not accurate (not exactly sure what's wrong). Some of the font icons seem weird as well.

Image

Expected behavior 🎯

Image

How to reproduce it (as minimally and precisely as possible) 🔬

No response

Workaround 🛠️

No response

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

No response

Uno.Sdk version (and other relevant versions) 📦

No response

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

No response

Activity

  1. added
    triage/untriaged
    difficulty/tbd
    on Jun 30, 2025
  2. added theissue type on Jun 30, 2025
  3. self-assigned this
    on Jun 30, 2025
  4. ramezgerges commented on Jun 30, 2025

    @ramezgerges
    ContributorAuthor

    @MartinZikmund Maybe related to #20747?

  5. ramezgerges commented on Jun 30, 2025

    @ramezgerges
    ContributorAuthor

    This is actually a problem with ThemeResource bindings not updating when the theme changes. This was only appearing with Material themes but I managed to minimize the repro to be Material-free.
    If you put this in the MergedDictionaries inside App.xaml

    				<ResourceDictionary>
    					<ResourceDictionary.MergedDictionaries>
    						<ResourceDictionary>
    							<ResourceDictionary.MergedDictionaries>
    								<ResourceDictionary>
    									<ResourceDictionary.ThemeDictionaries>
    										<ResourceDictionary x:Key="Light">
    											<x:String x:Key="TestText">LightMode</x:String>
    											<x:String x:Key="ChefsLogoWithIcon">ms-appx:///Assets/Icons/chefslogosignature.png</x:String>
    										</ResourceDictionary>
    										<ResourceDictionary x:Key="Dark">
    											<x:String x:Key="TestText">DarkMode</x:String>
    											<x:String x:Key="ChefsLogoWithIcon">ms-appx:///Assets/Icons/chefslogosignature_dark.png</x:String>
    										</ResourceDictionary>
    									</ResourceDictionary.ThemeDictionaries>
    								</ResourceDictionary>
    							</ResourceDictionary.MergedDictionaries>
    						</ResourceDictionary>
    					</ResourceDictionary.MergedDictionaries>
    				</ResourceDictionary>

    And put this somewhere in the UI

    	<StackPanel>
    		<Button Content="Toggle Theme" Click="ButtonBase_OnClick" />
    		<TextBlock x:Name="tb" Text="{ThemeResource TestText}" />
    		<Image Source="{ThemeResource ChefsLogoWithIcon}" />
    	</StackPanel>
    	private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
    	{
    		if (GetRootTheme() is ElementTheme.Dark)
    		{
    			SetRootTheme(ElementTheme.Light);
    		}
    		else
    		{
    			SetRootTheme(ElementTheme.Dark);
    		}
    	}
    	private void SetRootTheme(ElementTheme theme)
    	{
    		if (XamlRoot.Content is FrameworkElement root)
    		{
    			root.RequestedTheme = theme;
    		}
    	}
    	private ElementTheme GetRootTheme()
    	{
    		if (XamlRoot?.Content is FrameworkElement root)
    		{
    			return root.RequestedTheme;
    		}
    
    		return ElementTheme.Default;
    	}

    You'll notice that toggling the theme doesn't update the ThemeBindings for the TextBlock or the Image. It gets weirder; if you do this in a new app, it doesn't repro. If you put this in the WelcomePage of Chefs, it also doesn't repro. It only repros once you get past the WelcomePage (so starting from the LoginPage).

    cc. @kazo0

  6. MartinZikmund commented on Jul 2, 2025

    @MartinZikmund
    Member

    @ramezgerges what is the exception that occurs in Chefs? I guess we should use both your fix and also fix the Chefs code not to throw too

  7. ramezgerges commented on Jul 2, 2025

    @ramezgerges
    ContributorAuthor

    @MartinZikmund It's a NotImplemented exception with StatusBar.

  8. MartinZikmund commented on Jul 2, 2025

    @MartinZikmund
    Member

    CC @kazo0, it is worth checking why Chefs goes to that unsupported code path in the first place, to avoid silently throwing unnecessarily (or maybe it will actually stop throwing now that StatusBar was implemented)

  9. kazo0 commented on Jul 2, 2025

    @kazo0
    Contributor

    @ramezgerges / @MartinZikmund this has already been fixed in latest toolkit dev package unoplatform/uno.toolkit.ui#1421

  10. rajamatt commented on Jul 2, 2025

    @rajamatt
    Contributor

    Fixed with latest dev SDK version 6.1.0-dev.264, which uses latest toolkit version 7.1.0-dev.17.


    Tested with:
    Templates/SDK: 6.1.0-dev.264 (which uses Uno.Toolkit.WinUI version 7.1.0-dev.17)
    Platform(s): Desktop, Android, Wasm
    IDE: VS 2022 - 17.14.6
    OS: Windows

  11. github-actions commented on May 6, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.

  12. locked as resolved and limited conversation to collaborators on May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

difficulty/tbdtriage/untriaged

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions