wpf如何删除矩形(角)线形式的边框

时间:2018-11-23 03:13:47

标签: c# wpf xaml

<DockPanel Margin="5,5,5,5" Background="Red"> //the line color refercence this.
    <DockPanel Margin="0,12,0,0" HorizontalAlignment="Left">
        <Path Data="M 12,12 C 5,10.3 2.9,7.6 0.25,0.25 6.9,5.16 8.5,5.1 12,5" Fill="#EEEEEE" />
        <Border
            Margin="0,-6,0,0"
            Background="#EEEEEE"
            BorderBrush="#EEEEEE"
            BorderThickness="5"
            CornerRadius="5,5,5,5">
                <TextBlock>#Test</TextBlock>
        </Border>
    </DockPanel>
</DockPanel>

我已经创建了一个边框来设置CornerRadius和BorderThickness,但是内部的Border将显示矩形(角)线。我可以删除它吗?谢谢。

zoom

其他情况:

other case

2 个答案:

答案 0 :(得分:0)

这对我有用:

<DockPanel Margin="0,12,0,0" HorizontalAlignment="Left">
    <Path Data="M 12,12 C 5,10.3 2.9,7.6 0.25,0.25 6.9,5.16 8.5,5.1 12,5" Fill="#EEEEEE" />
    <Border
        Margin="0,-6,0,0"
        Background="#EEEEEE"
        CornerRadius="5"
        Padding="5">
        <TextBlock>#Test</TextBlock>
    </Border>
</DockPanel>

答案 1 :(得分:0)

这将解决问题。

<DockPanel Margin="5,5,5,5" Background="red">
    <DockPanel Margin="0,12,0,0" HorizontalAlignment="Left">
        <Path Data="M 12,12 C 5,10.3 2.9,7.6 0.25,0.25 6.9,5.16 8.5,5.1 12,5" Fill="#EEEEEE" Margin="0,0,-1,0"/>
        <Border Margin="0,-6,0,0" Background="#EEEEEE" CornerRadius="5" Padding="5">
            <TextBlock>#Test</TextBlock>
        </Border>
    </DockPanel>
</DockPanel>