Skip to content

Style Trigger for PackIcon #2720

Closed Answered by Keboo
enumerable-entity asked this question in Q&A
Discussion options

You must be logged in to vote

@enumerable-entity I assume the issue you are running into is the Foreground property not changing on your PackIcon when IsCompleted is set to true. The reason for this is because you have set the Foreground property on the PackIcon directly. Within WPF, these direct assignments always take precedence over anything in a style; which is why the style trigger does not appear to work.

To get the behavior you want, you need to set the default value in the style and then the trigger can override it. Something like this:

<materialDesign:PackIcon                 
    Kind="Calendar" 
    DockPanel.Dock="Right" 
   VerticalAlignment="Center" 
   Height="15" 
   Width="15" 
   Margin="10,0,5,0">
 …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@enumerable-entity
Comment options

Answer selected by enumerable-entity
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