Windows Dev Center

Border.BorderBrush Property

Gets or sets the Brush that is used to create the border.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public Brush BorderBrush { get; set; }
<Border BorderBrush="colorString"/>

XAML Values


Within opening and closing property elements for Border.BorderBrush, exactly one object element for an object that derives from Brush. This is typically one of the following classes: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, VideoBrush.


The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See the XAML Values section in Color.

Property Value

Type: System.Windows.Media.Brush
The brush that fills the border.

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

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">
        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
            <GradientStop Color="Gold" Offset="0"/>
            <GradientStop Color="Purple" Offset="1"/>
    <TextBlock Text="Gradient Brush" TextWrapping="Wrap" VerticalAlignment="Center" />

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2015 Microsoft