wpf边框比标签大得多

Let*_*lle 1 c# wpf xaml label

我想在标签周围放一个边框.但边界似乎有一些填充,或边缘,并没有接近标签.

 <Style x:Key="ArithmeticBorder" TargetType="Border">
            <Setter Property="BorderBrush" Value="Blue" />
            <Setter Property="BorderThickness" Value="6" />
            <Setter Property="CornerRadius" Value="6" />
            <Setter Property="Grid.Row" Value="4"/>
            <Setter Property="Grid.Column" Value="0"/>
        </Style>
 <Border Style="{StaticResource ArithmeticBorder}">
        <Label Content="Arithmetic" 
           HorizontalAlignment="Left" 
           Foreground="DarkBlue"
           Background="Yellow"
           FontStyle="Oblique"
           FontSize="16"
           FontFamily="Comic"
           Height="58.012" 
           Width="100"
           Margin="0,23.2,0,0"            
           VerticalAlignment="Top" 
           HorizontalContentAlignment="Center"
           VerticalContentAlignment="Center"
           />
Run Code Online (Sandbox Code Playgroud)

mm8*_*mm8 5

取下Margin,HorizontalAlignment并且Width属性Label:

<Border Style="{StaticResource ArithmeticBorder}">
    <Label Content="Arithmetic" 
           Foreground="DarkBlue"
           Background="Yellow"
           FontStyle="Oblique"
           FontSize="16"
           FontFamily="Comic"
           Height="58.012"         
           VerticalAlignment="Top" 
           HorizontalContentAlignment="Left"
           VerticalContentAlignment="Center"
           />
</Border>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述