我已经为这样的按钮创建了一个样式
<Style TargetType="{x:Type Button}" x:Key="BoutonRessources">
<Setter Property="Width" Value="18" />
<Setter Property="Margin" Value="-1,0,-2,0" />
<Setter Property="ToolTip" Value="Clear" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="BoutonToolbarSelected.png"/>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="22"/>
<Setter Property="Width" Value="32"/>
</Trigger>
</Style.Triggers>
</Style>
我的按钮出现在我的屏幕上,但是当鼠标悬停在按钮上时,它不显示我的“BoutonToolbarSelected.png”。你知道为什么吗 ?
这是我如何调用我的按钮:
<Button Style="{StaticResource BoutonRessources}" >
<Image Source= "xRtDiva_XWPF_TBR_PREMIER.PNG_IMAGES.png" Height="18"/>
</Button>
非常感谢 :)