Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 2.81 KB

panel_background.md

File metadata and controls

46 lines (33 loc) · 2.81 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.Panel.Background
winrt property

Windows.UI.Xaml.Controls.Panel.Background

-description

Gets or sets a Brush that fills the panel content area.

-xaml-syntax

<panel Background="{StaticResource resourceName}"/>
- or -
<panel Background="colorString"/>
- or -
<panel>
  <panel.Background>singleBrush</panel.Background>
</panel>

-xaml-values

resourceName
resourceNameThe resource name (x:Key attribute 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
colorStringThe 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
singleBrushWithin 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 The brush that fills the panel content area. The default is **null**, (a null brush) which is evaluated as [Transparent](../windows.ui/colors_transparent.md) for rendering.

-remarks

The Background value for a Panel-derived panel is visible underneath the inner area if the elements that are in the Children collection have transparency or null brushes for any of their defining area. It displays in the child margin area for any case where a child element has a nonzero Margin affecting its position. It is also visible between the layout positions of any child elements regardless of margin, although that can depend on how the panel implements its layout behavior. For example, in a Canvas, any pixel in the content area where there's not an absolutely positioned element covering it will show the panel Background brush.

If you're using a Panel class such as Grid or StackPanel as the root element of a control template, it's a common practice to use a {TemplateBinding} markup extension to bind the panel's background to the Control.Background property of the template parent (the control class that uses your template).

-examples

-see-also

Use brushes