Border.Background Property

July 28, 2014

Gets or sets the Brush that fills the background of the border.

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

public Brush Background { get; set; }
<Border>
  <Border.Background>
    singleBrush
  </Border.Background>
</Border>
<Border Background="colorString"/>

XAML Values

singleBrush

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

colorString

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 background.

Dependency property identifier field: BackgroundProperty

The following example shows how to set the background of a Border.


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


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft