Border.BorderBrush Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets the Brush that is used to create the border.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
Dependency property identifier field: BorderBrushProperty
The BorderThickness property is 0 by default. In order for the BorderBrush to be visible, you must set the BorderThickness to a nonzero value.
The following example shows how to set the border to a solid color.
<Border BorderThickness="5" BorderBrush="Blue" > <StackPanel Grid.Column="0" Grid.Row="0"> <TextBlock Text="One"/> <TextBlock Text="Two"/> <TextBlock Text="Three"/> </StackPanel> </Border>
You can also make the border using brushes that derive from Brush, such as LinearGradientBrush, which is shown below.
<Border BorderThickness="10" Grid.Column="2" Grid.Row="0"> <Border.BorderBrush> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <GradientStop Color="Gold" Offset="0"/> <GradientStop Color="Purple" Offset="1"/> </LinearGradientBrush> </Border.BorderBrush> <TextBlock Text="Gradient Brush" TextWrapping="Wrap" VerticalAlignment="Center" /> </Border>