[ACCEPTED]-How can I design individually the Border-Sides in XAML-xaml
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:
BorderThickness="1,2,3,4"
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"/>
</Border>
or (sets left, top, right, bottom 4 thickness):
<Border BorderBrush="Blue" BorderThickness="1,2,3,4">
<TextBlock Text="Inside border"/>
</Border>
If you need more control of the 3 border you can use a panel for layout. E.g. using 2 a <Grid>
:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<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"/>
</Grid>
You are free to put other visual elements 1 in the grid cells.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.