我尝试在鼠标悬停时设置按钮的更改图像。 我尝试过代码,但是我在对象中遇到了错误。有人能帮助我吗? 谢谢
<Grid>
<Page.Resources>
<ImageBrush x:Key="Aggiungi_Ticket_normal" ImageSource="Properties/Icons/add-2-512.png" />
<ImageBrush x:Key="Aggiungi_Ticket_hover" ImageSource="Properties/Icons/search-2-512.pngg" />
<ControlTemplate TargetType="Button" x:Key="btnAggiungi">
<Grid Name="button" Background="{StaticResource Aggiungi_Ticket_normal}">
<ContentPresenter/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="button" Property="Background" Value="{StaticResource Aggiungi_Ticket_hover}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Page.Resources>
<Button Name="btnAggiungi" Template="{StaticResource btnAggiungi}" HorizontalAlignment="Left" Margin="50,56,0,0" VerticalAlignment="Top" Width="100" Height="100" Click="btnAggiungi_Click" Cursor="Hand"/>