Style Trigger for ImageSourceLarge not working

Ribbon for WPF Forum

Posted 14 years ago by Ken Hanson
Version: 10.1.0521
Avatar
Actipro,

I would like a ribbon button to show a different image based on its IsChecked value. However it is ignoring my style triggers. What am I doing incorrectly?

<ribbon:Button Name="mnuRun" ImageSourceLarge="/Resources/Images/PlayButton32.png" ImageSourceSmall="/Resources/Images/PlayButton24.png" Command="local:ApplicationCommands.TestRun" IsChecked="False">
<ribbon:Button.Style>
<Style TargetType="ribbon:Button">
<Style.Triggers>
<Trigger Property="ribbon:Button.IsChecked" Value="True">
<Setter Property="ribbon:Button.ImageSourceLarge" Value="/Resources/Images/StopButton32.png"/>
<Setter Property="ribbon:Button.ImageSourceSmall" Value="/Resources/Images/StopButton24.png"/>
</Trigger>
<Trigger Property="ribbon:Button.IsChecked" Value="False">
<Setter Property="ribbon:Button.ImageSourceLarge" Value="/Resources/Images/PlayButton32.png"/>
<Setter Property="ribbon:Button.ImageSourceSmall" Value="/Resources/Images/PlayButton24.png"/>
</Trigger>
</Style.Triggers>
</Style>
</ribbon:Button.Style>
</ribbon:Button>

Best Regards,

Ken

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ken,

If you remove the ImageSourceSmall/Large property settings on the main ribbon:Button tag, it will work. Otherwise your triggers don't have priority to override the value.


Actipro Software Support

Posted 14 years ago by Ken Hanson
Avatar
Actipros,

Thanks for the quick response. That worked perfectly.

Since I am using the IsChecked property for my setter, is there a way to disable the highlight for the button when is checked. If so my button work work exactly like a toggle button where the image would be the sole indication as to which state I'm in.

Best Regards,

Ken
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ken,

Sorry but you'd probably have to retemplate the control if you'd want to remove the highlight.


Actipro Software Support

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.