我有一个WPF文本块,我试图使它的左上角和右上角变圆,所以我将它括在一个边框内:
<Border CornerRadius="10 10 0 0"
BorderThickness="2"
BorderBrush="DarkBlue"
Margin="10 15 10 0">
<TextBlock Text="This is a TextBlock with rounded top left and top right corners"
Background="Yellow"
Foreground="Black"
TextAlignment="Center" />
</Border>
这种方法的问题是,当边框背景色与TextBlock背景色不同时,它不起作用。显示如下(请参见左上角和右上角):
它只在我将TextBlock背景色设置为透明时起作用,但我需要将其设置为与透明不同的颜色。