-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Fix color animation bug of title bar buttons #8649
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent work. Thank you for figuring it out!
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
In dark mode (and high contrast mode), color animation of title bar button uses wrong color. Cause of this issue is using invalid data in `ColorAnimation`. I fixed this bug by changing `ColorAnimation` value in XAML layout file. According to a [forum post], `To` value of `ColorAnimation` must be frozen. But original source code uses "color binding" which makes this value dynamic. As a result, the value set by default is always used, that means, light mode. So I added new resource named `CaptionButtonStrokeColor` and `CaptionButtonBackgroundColor` which has static color value. In light mode and dark mode, I set `SystemBaseHighColor` in the color resource. `SystemBaseHighColor` is the same as `SystemControlForegroundBaseHighBrush.Color` which is originally used in animation. The background color animation happened to work correctly because its value is the same between light mode and dark mode. But I also fixed background color animation. ## Validation Steps Performed There is no need to add new test with this fix. - I changed the `theme` value in `settings.json` and confirmed that the correct color values were used. - I confirmed that it works correctly even if the Windows theme is changed. [forum post]: https://social.msdn.microsoft.com/Forums/vstudio/en-US/027c364f-5d75-424f-aafd-7fb76b10b676/templatebinding-on-storyboard?forum=wpf Closes #7314 (cherry picked from commit 713027b)
🎉 Handy links: |
🎉 Handy links: |
In dark mode (and high contrast mode), color animation of title bar button uses wrong color. Cause of this issue is using invalid data in `ColorAnimation`. I fixed this bug by changing `ColorAnimation` value in XAML layout file. According to a [forum post], `To` value of `ColorAnimation` must be frozen. But original source code uses "color binding" which makes this value dynamic. As a result, the value set by default is always used, that means, light mode. So I added new resource named `CaptionButtonStrokeColor` and `CaptionButtonBackgroundColor` which has static color value. In light mode and dark mode, I set `SystemBaseHighColor` in the color resource. `SystemBaseHighColor` is the same as `SystemControlForegroundBaseHighBrush.Color` which is originally used in animation. The background color animation happened to work correctly because its value is the same between light mode and dark mode. But I also fixed background color animation. ## Validation Steps Performed There is no need to add new test with this fix. - I changed the `theme` value in `settings.json` and confirmed that the correct color values were used. - I confirmed that it works correctly even if the Windows theme is changed. [forum post]: https://social.msdn.microsoft.com/Forums/vstudio/en-US/027c364f-5d75-424f-aafd-7fb76b10b676/templatebinding-on-storyboard?forum=wpf Closes microsoft#7314
In dark mode (and high contrast mode), color animation of title bar
button uses wrong color. Cause of this issue is using invalid data in
ColorAnimation
. I fixed this bug by changingColorAnimation
valuein XAML layout file.
According to a forum post,
To
value ofColorAnimation
must befrozen. But original source code uses "color binding" which makes this
value dynamic. As a result, the value set by default is always used,
that means, light mode.
So I added new resource named
CaptionButtonStrokeColor
andCaptionButtonBackgroundColor
which has static color value.In light mode and dark mode, I set
SystemBaseHighColor
in the colorresource.
SystemBaseHighColor
is the same asSystemControlForegroundBaseHighBrush.Color
which is originally used inanimation.
The background color animation happened to work correctly because its
value is the same between light mode and dark mode. But I also fixed
background color animation.
Validation Steps Performed
There is no need to add new test with this fix.
theme
value insettings.json
and confirmed that thecorrect color values were used.
changed.
Closes #7314