我使用帶有漸變背景的wpf按鈕。但背景不適用於鼠標懸停。我的代碼有什麼問題嗎?wpf按鈕懸停漸變不起作用
<Button x:Name="button1" Content="Login" HorizontalAlignment="Left" Margin="172,149,0,0" VerticalAlignment="Top" Width="91" Click="button_Click" Height="34" Foreground="Black">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF2B4702" Offset="1"/>
<GradientStop Color="#FFAFDE80" Offset="0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF2B4702" Offset="0"/>
<GradientStop Color="#FFAFDE80" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
謝謝,我從你的回答中瞭解到。 – Neo