WPF:在不改变其形式的情况下扩展路径

WPF:在不改变其形式的情况下扩展路径,wpf,layout,dynamic,path,size,Wpf,Layout,Dynamic,Path,Size,我想创建自定义shaepd标签,以象在向导中一样象征进度。 但是当我将Strech属性设置为Fill时,路径的角度是不同的 XAML代码: <Style x:Key="NavigationStepLabel" TargetType="{x:Type Label}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetTyp

我想创建自定义shaepd标签,以象在向导中一样象征进度。 但是当我将Strech属性设置为Fill时,路径的角度是不同的

XAML代码:

<Style x:Key="NavigationStepLabel" TargetType="{x:Type Label}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Label}">
                <Grid>
                    <Path Fill="{TemplateBinding Background}"  Data="M 0,0 h 50 l 5,20 l -5,20 h -50 l 5,-20 l -5,-20" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="2" Stretch="Fill"/>
                    <ContentPresenter Grid.Column="1" Margin="20,0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="HorizontalAlignment" Value="Center"/>
    <Setter Property="VerticalAlignment" Value="Center"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="BorderBrush" Value="Gray"/>
</Style>

...

<Label Style="{StaticResource NavigationStepLabel}" Content="Start"> 
    <Label.Background>
         ...
    </Label.Background>
</Label>

...
...

有没有一种方法可以在不使用不同角度箭头的情况下动态设置标签路径的大小?

将“拉伸”设置为“统一”或“统一”或“统一”或“MTOFILL”。@Clemens如果我将其设置为“统一”,则所有路径的大小都相同,但对于文本来说都太小。如果我将其设置为UniformToFill,表单将被保留,但是路径也会在高度上进行缩放,然后它们超出了所在容器的边界,并且具有不同的高度。