[ACCEPTED]-How can I design individually the Border-Sides in XAML-xaml

Accepted answer
Score: 68

The border thicknes is a composite property 4 of the left, top, right and bottom thicknesses 3 (notice the difference in order from CSS). If 2 you specify only one value you set all of 1 them, but you can specify them separately:

Score: 13

In XAML you don't have border property on 8 elements like you have in CSS. However, you 7 can use a <Border> element and set individual thicknesses 6 just as you can i CSS (sets left-right and 5 top-bottom border thickness):

<Border BorderBrush="Blue" BorderThickness="2,4">
  <TextBlock Text="Inside border"/>

or (sets left, top, right, bottom 4 thickness):

<Border BorderBrush="Blue" BorderThickness="1,2,3,4">
  <TextBlock Text="Inside border"/>

If you need more control of the 3 border you can use a panel for layout. E.g. using 2 a <Grid>:

    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>
    <RowDefinition Height="Auto"/>
    <ColumnDefinition Width="Auto"/>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="Auto"/>
  <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="Blue" BorderThickness="2"/>
  <Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="Green" BorderThickness="4"/>
  <Border Grid.Row="1" Grid.Column="0" BorderBrush="Red" BorderThickness="3"/>
  <Border Grid.Row="1" Grid.Column="2" BorderBrush="Red" BorderThickness="3"/>
  <TextBlock Grid.Row="1" Grid.Column="1" Text="Inside border"/>

You are free to put other visual elements 1 in the grid cells.

More Related questions