Home > DeveloperSection > Forums > Bottom borders issue using WPF Grid
Aaron Douglas
Aaron Douglas

Total Post:20

Points:140
Posted on    October-14-2013 7:42 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 1410  View(s)
Rate this:

I'd like to set a bottom border on each row in the grid, but can only find how to put all 4 borders around each cell.. my code is quite simple

<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>

For another grid I'm using that needs all four borders, I'm using

<Border Grid.Column="0" Grid.Row="0" BorderBrush="#61738B" BorderThickness="1" />

P.S. The contents of the grid are some labels, textboxes, etc.. if that matters at all.

Appreciate any pointers.



Brad Pitt
Brad Pitt

Total Post:61

Points:429
Posted on    October-14-2013 7:55 AM

I had luck putting a bottom border on a whole row by including a Border Node with BorderThickness="0 1 0 1" surrounding the Grid Node. Like this:

Border Style="{StaticResource ItemBorderStyle}" BorderThickness="0 1 0 1"

            Grid Style="{StaticResource GridItemStyle}"

Don't want to miss updates? Please click the below button!

Follow MindStick