Replies: 1 comment
-
Seems to be related to #3783 (comment). Meanwhile, I use the following code
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Making a basic text editor with WinUI, MVVM. Stucked in default RichEditBox foreground and background color viewmodel properties based on selected theme, to show them in AppBar ColorPickerButtons (from CommunityToolkit, same results with "basic" ColorPicker).
Using
Application.Current.Resources[]
:Tried different resource names and still not getting correct colors in dark theme (white foreground and whatever background color uses RichEditBox). They always show light theme colors:
TextControlForegroundFocused
(that TextBox Class msdn page states it is "Text color when focused")TextFillColorPrimary
SystemControlBackgroundAltHighBrush
SystemColorButtonFaceColor
SystemColorButtonTextColor
Same results using
new TextBox().Resources
as property value (TextBox because, again, msdn TextBox class page states that resources used by TextBox are shared with RichEditBox, among other controls. Same results using RichEditBox):TextBoxForegroundThemeBrush
TextBoxBackgroundThemeBrush
So maybe the question is how to know what specific resource / themeresource names are used in specific control properties. I see resource names in resource xaml files are very descriptive but for now it is a mess for me. Also, I never see dark theme in those files, only Default, Light and HighContrast, and there are no colors matching dark theme, so it is evident that I am missing something (or many things :)
Actually, using in xaml works with selected theme, e.g:
<controls:ColorPickerButton SelectedColor="{ThemeResource SystemBaseHighColor}"/>
But not if using it in code:
It always shows white foreground color, despite of selected theme.
Beta Was this translation helpful? Give feedback.
All reactions