Posted 3 months ago by BenjaminLopVic - France
Version: 25.1.1
Avatar

Hello,

I'm trying to override the background of a button when the mouse is over, but I can't get it to work.
I've tried several approaches, such as:

<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="Red"/>
        </Trigger>
    </Style.Triggers>
</Style>

Thanks,

Benjamin.

Comments (1)

Answer - Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

If you are using our themes for native WPF controls, then the above via a Style.Trigger won't work because we adjust the brushes within the Button's Template.  You could override the brush resource AssetResourceKeys.ButtonBackgroundHoverBrushKey if you'd like a different value.

This documentation topic describes how to override brush resources.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.