Border.Background Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
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 -
<Border>
<Border.Background>singleBrush</Border.Background>
</Border>
Property Value
The brush that fills the background. The default is null, (a null brush) which is evaluated as Transparent for rendering.
Examples
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" />
</Border>
Remarks
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.