Update background color of selected Tree View item to meet contrast ratio requirement
See original GitHub issueDescribe the bug
Selected TreeViewItems do not currently meet the 3:1 contrast ratio requirement relative to unselected items, as specified in MAS 1.4.11 - Non-text Contrast.
Light theme ratio is 1.5:1
Dark theme ratio is 1.3:1
Additional context
This issue is closely related to #2908 but requires different theme resources to be updated.
Proposed fix Create new resources
<RevealBackgroundBrush x:Key="SystemControlHighlightAccent1RevealBackgroundBrush" TargetTheme="Dark" Color="{ThemeResource SystemAccentColorDark1}" FallbackColor="{ThemeResource SystemAccentColorDark1}" />
<RevealBackgroundBrush x:Key="SystemControlHighlightAccent1RevealBackgroundBrush" TargetTheme="Light" Color="{ThemeResource SystemAccentColorLight1}" FallbackColor="{ThemeResource SystemAccentColorLight1}" />
Update TreeViewItemBackgroundSelected
to use the new SystemControlHighlightAccent1RevealBackgroundBrush
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
How to change TreeViewItem background color according ...
I would like to change the background of any TreeViewItem according to its bound data property "IsHiglighted". I would like to set the...
Read more >How to change the Background property of a selected ...
Hi all, I would like to change the Background color of selected items of ListViewItems. Many tries but no result. Only replacing the...
Read more >Accessibility contrast requirements explained and how to ...
The color contrast ratio for both the icon and dark grey circle and the dark grey circle and light grey background is 6.38:1,...
Read more >Improving colour contrast ratios in Atom
Using the Select element tool, inspect the tree view background and filenames and note which colours they use for display.
Read more >ANDI - Modules
Suggested Color: If the contrast ratio does not meet the minimum requirement, and there is no semi-transparency involved c ANDI will suggest color...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, I am asking @YuliKl for this reason (and consistency reasons) to consider switching the currently used TreeViewItem selected brushes to the ones used by the ListViewItem. If we won’t do that, @dpaulino, you can always override those brushes yourself as shown in that issue (while waiting for a fix which would presumably have to wait until WinUI 3).
Closing this issue. TreeView styles and colors are being updated in the near future.