-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ThemeListener.ThemeChanged does not work in WinUI 3 #555
Comments
Hello yoshiask, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
I believe this is still a known issue as there's no corresponding API yet in the WinAppSDK for this, right @azchohfi? Not sure how we should best mark things that we know aren't working yet... |
Yes, these events are not supported: I don't know for sure, but I believe it will be possible to track this when they add the EnvironmentVariableChangeTracker. It should be out on 1.1, but I'm not 100% sure. |
@azchohfi @zateutsch this is another case similar to CommunityToolkit/WindowsCommunityToolkit#4356 where there's a missing API or an API that doesn't work in unpackaged. I'm not sure if there's system APIs that are in similar places and get annotated as such somehow? Is there any better attributes or practice we should be doing here to better indicate what's not going to work currently with WinUI 3/WASDK? |
这是我的解决方案,可能有些笨拙。欢迎大佬献策。 我使用visual studio 2022创建了一个新的空白应用,使用的是Windows app sdk 1.1.5,经过测试发现,当系统主题发生变化时,UISettings().ColorValuesChanged事件仍然能够被触发。在事件触发后,可以读取注册表 “计算机\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize”项的两个键值,其中“AppsUseLightTheme”对应的是“默认应用模式”的设置,“SystemUsesLightTheme”对应的是“默认Windows模式“的设置。 AppsUseLightTheme 值为0时,是深色主题,1时是浅色主题。 这是我测试的代码。 MainWindow.xaml
MainWindow.xaml.cs using System; // To learn more about WinUI, the WinUI project structure, namespace App1; /// /// An empty window that can be used on its own or navigated to within a Frame. /// public sealed partial class MainWindow : Window, INotifyPropertyChanged { private string testString = string.Empty;
} |
It seems like |
Any word on when this might be fixed, or if there's a known viable workaround? |
There is, but somehow still not getting reviewed |
I've triaged and bumped the participants, hope to see movement again soon! 🤞 |
Describe the bug
ThemeListener
seems to do nothing in WinAppSDK apps. A comment in a related issue points out that the eventsThemeListener
relies on are no longer supported in WinUI 3.7.1.2 for UWP
Steps to Reproduce
Steps to reproduce the behavior:
Place the following code anywhere inside a WinAppSDK 1.0.0 C# app:
Observe that the
ThemeChanged
handler is never fired.Expected behavior
The
ThemeChanged
event should fire when the system theme is changed.Environment
NuGet Package(s): CommunityToolkit.WinUI.UI
Package Version(s): 7.1.2
Windows 10 Build Number:
App min and target version:
Device form factor:
Visual Studio version:
The text was updated successfully, but these errors were encountered: