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

Small update to button styles #4357

Merged
merged 3 commits into from Jul 24, 2020
Merged

Small update to button styles #4357

merged 3 commits into from Jul 24, 2020

Conversation

amwx
Copy link
Contributor

@amwx amwx commented Jul 24, 2020

What does the pull request do?

To make overriding the default Button template easier, this PR adjusts the pseudoclass selectors to target the ContentPresenter defined in the default fluent template instead of generically using ContentPresenter, i.e. changing
/template/ ContentPresenter"
to
/template/ ContentPresenter#PART_ContentPresenter"

Also applies to ToggleButton and RepeatButton

@maxkatz6
Copy link
Member

Probably you need to make same changes in RepeatButton.xaml and ToggleButton.xaml.

Copy link
Member

@jmacato jmacato left a comment

Choose a reason for hiding this comment

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

LGTM!

@jmacato jmacato merged commit b2374c4 into AvaloniaUI:master Jul 24, 2020
@FrankenApps
Copy link

I really think this should be pointed out somewhere in the documentation. Something like that:

If you want to override the BackgroundColor of a button on pointerover, use this:

<Button.Styles>
  <Style Selector="Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="Red"/>
  </Style>
  <Style Selector="Button:not(:pointerover) /template/ ContentPresenter#PART_ContentPresenter">
      <Setter Property="Background" Value="Transparent"/>
  </Style>
</Button.Styles>

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

Successfully merging this pull request may close these issues.

None yet

5 participants