Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Control.Background property

Applies to Windows and Windows Phone

Gets or sets a brush that provides the background of the control.

Syntax


public Brush Background { get; set; }


<control Background="{StaticResource resourceName}"/>



<control Background="colorString"/>



<control>
  <control.Background>singleBrush</control.Background>
</control>


XAML Values

resourceName

The resource name (x:Key value) of an existing XAML resource that defines a brush. This is the recommended way to specify Brush values in XAML if you have any intention of using the same colors or brushes in more than one part of your UI. See Remarks in Brush or ResourceDictionary and XAML resource references.

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.

singleBrush

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

Property value

Type: Brush

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

Remarks

Each control might apply this property differently based on its visual template. This property only affects a control whose template uses the Background property as an input for the template's UI properties. On other controls, this property has no effect. Typically, a control uses a TemplateBinding to bind its Background value to the Background of a Panel that is the root element of the control template. For example, to Grid.Background. For more info about visual templates and control templating, see reference page for the Template property, or Quickstart: Control templates.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

Control
Quickstart: Using brushes
Control.BorderBrush
Panel.Background

 

 

Show:
© 2014 Microsoft