Background Property

Panel.Background Property


Gets or sets a Brush that is used to fill the area between the borders of a Panel.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

member Background : Brush with get, set

Property Value

Type: System.Windows.Media.Brush

A Brush. This default value is null.

Panel elements do not receive mouse or stylus events if a Background is not defined. If you need to handle mouse or stylus events but do not want a background for your Panel, use Transparent.

The following example sets the Background of a Grid to a RadialGradientBrush.

        Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
        <GradientStop Color="Yellow" Offset="0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="Green" Offset="1" />

.NET Framework
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
© 2015 Microsoft