运行结果:
1、资源设置、绑定
<Window.Resources>
<Style x:Key="NoneStyleBtn" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#4E6593"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="#000"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="#4E6593"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
2、按钮内嵌一个textblock
<Button Grid.Row="1" Grid.Column="1" Style="{StaticResource NoneStyleBtn}" ToolTip="移除"
Command="{Binding DeleteItemCommand}" CommandParameter="1" Margin="10,18,26,5">
<TextBlock Text="×" Foreground="Red" FontSize="18" FontWeight="Bold" Cursor="Hand" Height="18"/>
</Button>