WPF 消除border边框颜色与背景色之间细线

发布时间 2023-09-07 14:17:28作者: 潇潇烟雨

在WPF中,当boder的边框色与boder的背景为同一个色时,在整个border下方会有一条细线,如下图:

 <Border x:Name="bdMain" Background="{DynamicResource QueryCouponsBackground}" BorderThickness="1,1,1,3" CornerRadius="8">
                
</Border>

  

 

 

解决办法:

<Border x:Name="bdMain" CornerRadius="{Binding ElementName=secondBorder,Path=CornerRadius}" Background="{Binding ElementName=secondBorder,Path=Background}">
                <Border x:Name="secondBorder" Background="{DynamicResource QueryCouponsBackground}" BorderThickness="1,1,1,3" CornerRadius="8" BorderBrush="{DynamicResource QueryCouponsBackground}" >

                </Border>
</Border>