我想在网格中的每一行设置一个底部边框,但只能找到如何在每个单元格周围放置所有 4 个边框。
<Grid Height="174" HorizontalAlignment="Left" Margin="23,289,0,0" Name="grid2" VerticalAlignment="Top" Width="730">
<Grid.RowDefinitions>
<RowDefinition Height="45" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="255" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="95" />
<ColumnDefinition Width="95" />
</Grid.ColumnDefinitions>
</Grid>
对于我正在使用的另一个需要所有四个边框的网格,我正在使用
<Border Grid.Column="0" Grid.Row="0" BorderBrush="#61738B" BorderThickness="1" />
附言网格的内容是一些标签、文本框等。如果这很重要的话。
最佳答案
在 Border
控件上您可以执行 BorderThickness="0 0 0 1"
以仅显示底部边框。
上下边框厚度为5,左右边框厚度为0
BorderThickness="0 5"
上下边框厚度为0,左右边框厚度为5
BorderThickness="5 0"
边框粗细 - 左:1,上:2,右:3,下:4
BorderThickness="1 2 3 4"
希望这对您有所帮助!
关于c# - WPF 网格上的底部边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3693820/