Background Property (UIElement)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Gets or sets the Brush that describes the background of the object.

XAML
<object Background="Brush" .../>
Scripting
value = object.background
object.background = value

Property Value

Brush

The brush that is used to fill the background of the object. If either the object's Height or Width property values are equal to 0, the Background property value is ignored.

This property is read/write. The default value is null.

Remarks

The following XAML example shows how to define a LinearGradientBrush object that is used as the Background property value for the Canvas object:

XAML
<Canvas
  xmlns="https://schemas.microsoft.com/client/2007"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
  Width="200" Height="80"
  >
  <!-- Define a LinearGradientBrush for the Canvas Background property. -->
  <Canvas.Background>
    <LinearGradientBrush>
      <GradientStop Color="Yellow" Offset="0.0" />
      <GradientStop Color="Orange" Offset="0.5" />
      <GradientStop Color="Red" Offset="1.0" />
    </LinearGradientBrush>
  </Canvas.Background>
</Canvas>

The XAML content of the previous example is displayed using a LinearGradientBrush object.

Canvas object rendered with a LinearGradientBrush

Note The Background property of the Silverlight plugin determines the background color of the client area of your Silverlight content.

Applies To

Canvas

See Also

Brush, Canvas, Background (Silverlight Plugin)