we are trying to set some button's properties if the mouse is over the Button. The strange thing is, that it works only for some properties.
We've created an blank WPF application and simply added these lines of code:
<Button Content="{Binding IsMouseOver, RelativeSource={RelativeSource Self},Mode=OneWay}">
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="Foreground" Value="Red" />
<Setter Property="Background" Value="Yellow" />
<Setter Property="BorderThickness" Value="5"></Setter>
<Setter Property="BorderBrush" Value="BurlyWood"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False">
<Setter Property="Foreground" Value="Green" />
<Setter Property="Background" Value="BlueViolet" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
The "false"-Trigger works like a charme. The "True"-Trigger only sets the BorderThickness and the Foreground. Background and Borderbrush will get ignored.
Can anyone tell me how to solve this problem??