Skip to content

How can I override the default pointerover style for a button? #17822

Answered by stevemonaco
Ha-rlan asked this question in Q&A
Discussion options

You must be logged in to vote

I'm using Fluent theme for this example.

There's some issue with going through templated ContentPresenters twice or some rule I don't understand. I've tried the following and it doesn't work:

<Style Selector="ListBox:not(.Base) ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter Button:pointerover /template/ ContentPresenter#PART_ContentPresenter">
    <Setter Property="Foreground" Value="#0000FF" />
    <Setter Property="Background" Value="#00FF00" />
</Style>

What does work is separating them without nesting:

<Window.Resources>
    <Color x:Key="MainColor">#FF0000</Color>
    <Color x:Key="FontColor">#808000</Color>
</Window.Resources>
<Window.Styles>
    <Style Selector

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Ha-rlan
Comment options

@stevemonaco
Comment options

Answer selected by Ha-rlan
@Ha-rlan
Comment options

@stevemonaco
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants