<UserControl x:Class="WpfApplication6.LeftButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<Style x:Key="ListLeftButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Rectangle x:Name="rectangle">
<Rectangle.Fill>
<ImageBrush ImageSource="skin/01228[46x62x8BPP].png"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Fill" TargetName="rectangle">
<Setter.Value>
<ImageBrush ImageSource="skin/01227[46x62x8BPP].png"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsDefaulted" Value="True"/>
<Trigger Property="IsMouseOver" Value="True"/>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Fill" TargetName="rectangle">
<Setter.Value>
<ImageBrush ImageSource="skin/01226[46x62x8BPP].png"></ImageBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False"/>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<StackPanel>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
<Button Style="{StaticResource ListLeftButton}" Width="50" Height="60"/>
</StackPanel>
</UserControl>
我利用模板自定义了按钮,这些按钮的样式都相同只是背景图片不一样,但我只会在模板中定义一张,要不同的按钮对应不同的图片应该怎么做呐?求解答,多谢