2
我有一個風格的按鈕,但我有幾個,並希望風格只適用於一個按鈕。我該怎麼做?只適用於WPF風格的一個按鈕
<Style TargetType="{x:Type Button}">
<Setter Property="Background" >
<Setter.Value>
<ImageBrush ImageSource="resources/main_play_normal.png"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" >
<Setter.Value>
<ImageBrush ImageSource="resources/main_play_over.png"/>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>