-
Notifications
You must be signed in to change notification settings - Fork 693
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
Can't set Foreground and Background colours for Checkbox #9236
Comments
Thank you for your reply! In my app, I am already statically setting the resources for the checkbox in a xaml file. However, what I need is the ability to set Foreground and Background colours dynamically, from C#, based on user input. Is there a way to do this, since the above CheckBox* properties used in the resource file are not exposed, or do I need to do some trickery in order to gain access to them? Thanks in advance! |
By code, a way can be by changing colors of elements in the Visual Tree
FindChildElement can be found in MainWindow.xaml.cs (I had copied/translated it from MS samples) |
Thanks again for your response. I will look at your suggestion. It would be nice if Microsoft provided consistent access to all the properties. I don't think it is reasonable to think that some properties should be static and not accessible from code. Hopefully, moving forward, the properties that can only be accessed in resource files are also accessible from C# code. |
Describe the bug
Setting Foreground and Background properties have no effect on Checkbox.
Checkbox text colour remains white
This means checkboxes can;t be used on containers with white backgrounds.
Steps to reproduce the bug
Expected behavior
Foreground and Background properties should be customizable
Screenshots
Text remains white instead of black text on aliceblue background.
If container background is white then text is lost
NuGet package version
Windows App SDK 1.4.3: 1.4.231115000
Packaging type
No response
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
Project files:
CheckBoxSample.zip
The text was updated successfully, but these errors were encountered: