Skip to content
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

High Contrast support for Graphing Calculator #878

Merged
merged 4 commits into from
Dec 20, 2019
Merged

High Contrast support for Graphing Calculator #878

merged 4 commits into from
Dec 20, 2019

Conversation

rudyhuyn
Copy link
Contributor

Description of the changes:

  • Add high contrast support to GraphControl
  • Add high contrast support to EquationInputTextArea

Also:

  • Rewrite button styles used in EquationInputTextArea to only modify their brushes instead of fully modify their templates (easier to maintain + less verbose)
  • Make EquationInputTextArea buttons more fluent.
  • localize the string "Enter an equation"
  • slighly modify the error state of EquationInputTextArea (display all 4 borders instead of only 3)
  • move all resources only used by Graphing Calculator from App.xaml to GraphingCalculator.xaml

Note: we want to keep the graph white background, black lines with dark theme for the moment.

How changes were validated:

  • Manually

@rudyhuyn rudyhuyn changed the base branch from master to feature/GraphingCalculator December 18, 2019 07:55
@rudyhuyn rudyhuyn assigned EriWong and alerickson and unassigned alerickson Dec 18, 2019
@rudyhuyn rudyhuyn added Enhancement graphing calculator Work items related to the graphing calculator feature. labels Dec 18, 2019
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<CornerRadius x:Key="TopButtonCornerRadius">4,4,0,0</CornerRadius>
<CornerRadius x:Key="BottomButtonCornerRadius">0,0,4,4</CornerRadius>
<CornerRadius x:Key="LeftButtonCornerRadius">4,0,0,4</CornerRadius>
<CornerRadius x:Key="RightButtonCornerRadius">0,4,4,0</CornerRadius>
<Color x:Key="GrapherAxesColor">White</Color>
<Color x:Key="GrapherBackground">Black</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
Copy link
Contributor

@EriWong EriWong Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HighContrast [](start = 51, length = 12)

I'm not seeing things in the graph change when we go directly from high contrast black to high contrast white. I'm not sure if this is our bug or a UWP bug though as our handler for background change doesn't get hit either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be related to an issue I experienced before where the high contrast colors seem to be equal to each other when switching between the modes. I had a work around where I set them to transparent inbetween, not sure if it would help here.

Copy link
Contributor Author

@rudyhuyn rudyhuyn Dec 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was because we used <StaticResource x:Key... /> so the color wasn't updated when the system switches from a High Contrast theme to another High Contrast theme. Unfortunately <ThemeResource x:Key don't work. I've found a workaround: instead of setting the color in the ResourceDictionary, I now create a new Style, this one being able to host a {ThemeResource}.

@joseartrivera This issue was different, it was because when you switch from a High Contrast mode to another one, the system only updates the Color, not the Brush, meaning GraphingControl which used the brush wasn't able to detect that the color change. This doesn't happen with other controls because they use the color of the brush we pass, not the case of GraphControl which create a copy of the color.

Copy link
Contributor

@EriWong EriWong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

played around with this and it looks good.

@EriWong EriWong merged commit 3942662 into microsoft:feature/GraphingCalculator Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement graphing calculator Work items related to the graphing calculator feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants