Reputation: 1800
How to create a Border with different edges. Do not have to be the exact the same. Just want to know how to set four different styles to border.
Upvotes: 2
Views: 222
Reputation: 7028
You cant do it with border but you can create a content control with same style some thing like.
<Style x:Key="DiffBorderStyle" TargetType="{x:Type ContentControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle
Fill="Black" Width="1"
Grid.RowSpan="3"/>
<Rectangle
Fill="Blue" Width="1"
Grid.Column="2"
Grid.RowSpan="3"/>
<Rectangle
Fill="Red" Height="1"
Grid.ColumnSpan="3"/>
<Rectangle
Fill="Black" Height="1"
Grid.Row="2"
Grid.ColumnSpan="3"/>
<ContentPresenter Grid.Column="1" Grid.Row="1"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
You can stylized each rectangle in style and also you can use Line in place of rectangle.
Hope it helps..
Upvotes: 1
Reputation: 4730
I don't think there is a way to control border style of each side. You can however put 4 borders on top of each other (or within each other) each having corresponding side with desired style and other sides with width 0
Upvotes: 5