Border.Background Property


Gets or sets the Brush that fills the background (inner area) of the border.

 property Brush ^ Background { Brush ^ get(); void set(Brush ^ value); };
Brush Background();

void Background(Brush value);
public Brush Background { get; set; }
var brush = border.background;
border.background = brush;
Public Property Background As Brush
<Border Background="{StaticResource resourceName}"/>
- or -
<Border Background="colorString"/>
- or -

Property Value


The brush that fills the background. The default is null, (a null brush) which is evaluated as Transparent for rendering.


The following example shows how to set the background of a Border to a solid color using an inline-defined attribute value "Cyan". The XAML parser uses this "Cyan" value to refer to the named color Colors.Cyan, and to create the SolidColorBrush instance that supplies the runtime value.

<Border Background="Cyan" CornerRadius="20" Grid.Column="2" Grid.Row="2">
    <TextBlock Text="Background Brush" TextWrapping="Wrap" VerticalAlignment="Center" />


The Background value for a Border is visible underneath the inner area if the element that is the Child element has transparency or null value brushes for any of its defining area. It is also visible between the border edge and the Child content if nonzero values are applied for a Padding value.

Applies to

See also