1.空样式按钮
<Style x:Key="EmptyButtonStyle" TargetType="Button">
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Button Width="50" Height="50" HorizontalAlignment="Left" Margin="4,0,0,0" Style="{StaticResource EmptyButtonStyle}" >
<Image Source="Styles/Images/KaraokeElibrary/button_left_normalmode.png"></
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ContentPresenter Content="{TemplateBinding Content}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Button Width="50" Height="50" HorizontalAlignment="Left" Margin="4,0,0,0" Style="{StaticResource EmptyButtonStyle}" >
<Image Source="Styles/Images/KaraokeElibrary/button_left_normalmode.png"></
2.透明样式按钮
<Style x:Key="TransparentButtonStyle" TargetType="Button">
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
ControlTemplate内的Grid如果不设置Background属性,则按钮Button的Click不会触发!
如
<ControlTemplate TargetType="Button">
<Grid />
</ControlTemplate>
<Grid />
</ControlTemplate>