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

Update RadialGauge to use theme resources #1771

Merged
merged 4 commits into from Feb 18, 2018

Conversation

skendrot
Copy link
Contributor

Issue: #1766

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[x] Sample app changes

What is the current behavior?

The RadialGauge text does not update properly when the theme changes

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Sample in sample app has been added / updated (for bug fixes / features)

What is the new behavior?

The text will update when the theme changes from light-dark or dark-light

Does this PR introduce a breaking change?

[x] No

Other information

Two properties were made obsolete with this change but still maintains functionality.

Text="{TemplateBinding Value}"
TextAlignment="Center" />
<TextBlock Margin="0"
FontSize="16"
Foreground="{TemplateBinding UnitBrush}"
Foreground="{ThemeResource RadialGaugeAccentBrush}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have this default to the Foreground brush if the RadialGaugeAccentBrush isn't specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How would it not be specified?

Copy link
Contributor

Choose a reason for hiding this comment

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

Foreground could set both UnitBrush and the ValueBrush, while the Accent is transparent, or something like that. Then setting the RadialGaugeAccentBrush can override the UnitBrush color.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry... I'm not following. How would RadialGaugeAccentBrush not be specified?

Copy link
Contributor

Choose a reason for hiding this comment

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

As in not manually defined. Probably not important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's defined in the ThemeDictionary

Copy link
Contributor

Choose a reason for hiding this comment

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

Nvm then

@nmetulev
Copy link
Contributor

This looks great other than I'm not sure if not having a property for the Units brush is the right thing to do. Or, is it possible to use the foreground property for both but enable the resource brush to be used to modify them individually?

The documentation should also be updated to reflect these changes.

@skendrot
Copy link
Contributor Author

skendrot commented Jan 30, 2018

This approach is how theming is done within core controls. There isn't a property for every brush used, but instead resources that are used.

The doc was updated to remove the old properties. Should we add a style and template section to the doc template with resource keys and descriptions?

@nmetulev
Copy link
Contributor

I would still expect Foreground to change the foreground of all the text elements, no?

Yeah, there should be a way for developers to discover resource they can modify to customize the app. Style and template seems like the right section for that

@skendrot
Copy link
Contributor Author

If foreground changes both elements then we lose functionality.

@nmetulev
Copy link
Contributor

If they can be individually modified with resources, the functionality would still there I would think? With this change, we will already be introducing breaking changes in 3.0 and asking the developer to use resources for one property anyway, why not for both.

@nmetulev
Copy link
Contributor

Ignore my last comment, this is not possible right now. Other than updating the docs and the bind file, it's good to go.

@XamlBrewer
Copy link
Contributor

Nice improvement!

@nmetulev
Copy link
Contributor

@skendrot, could you update the docs and we can merge this?

Copy link
Contributor

@nmetulev nmetulev left a comment

Choose a reason for hiding this comment

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

Looks great

@nmetulev nmetulev merged commit 30c6013 into CommunityToolkit:master Feb 18, 2018
@windowstoolkitbot
Copy link

This PR is linked to unclosed issues. Please check if one of these issues should be closed: #1766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants