Panel Panel Panel Class

Definition

Provides a base class for all Panel elements. Use Panel elements to position and arrange child objects in a UI page.

public class Panel : FrameworkElement, IPanelpublic class Panel : FrameworkElement, IPanelPublic Class Panel Inherits FrameworkElement Implements IPanel
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Remarks

Panel derived classes

Panel is the parent class for several immediately derived classes. Some of these are practical layout containers/panels. Others are intermediate base classes for specialized panels.

Constructors

Panel() Panel() Panel()

Provides base class initialization behavior for Panel derived classes.

protected Panel()protected Panel()Protected Sub New()
Attributes

Properties

Background Background Background

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

public Brush Background { get; set; }public Brush Background { get; set; }Public ReadWrite Property Background As Brush
<panel Background="{StaticResource resourceName}"/>

Value
Brush Brush Brush

The brush that fills the panel content area. The default is null, (a null brush) which is evaluated as Transparent for rendering.

Attributes

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).

See Also

BackgroundProperty BackgroundProperty BackgroundProperty

Identifies the Background dependency property.

public static DependencyProperty BackgroundProperty { get; }public static DependencyProperty BackgroundProperty { get; }Public Static ReadOnly Property BackgroundProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Background dependency property.

Attributes

Children Children Children

Gets the collection of child elements of the panel.

public UIElementCollection Children { get; }public UIElementCollection Children { get; }Public ReadOnly Property Children As UIElementCollection
<panel>
  oneOrMoreUIElements
</panel>
Value
UIElementCollection UIElementCollection UIElementCollection

The collection of child objects. The default is an empty collection.

Attributes

ChildrenTransitions ChildrenTransitions ChildrenTransitions

Gets or sets the collection of Transition style elements that apply to child content of a Panel subclass.

public TransitionCollection ChildrenTransitions { get; set; }public TransitionCollection ChildrenTransitions { get; set; }Public ReadWrite Property ChildrenTransitions As TransitionCollection
<panel>
  <panel.ChildTransitions>
    <TransitionCollection>
      oneOrMoreTransitions
    </TransitionCollection>
  </panel.ChildTransitions>
</panel>
Value
TransitionCollection TransitionCollection TransitionCollection

The strongly typed collection of Transition style elements.

Attributes

Remarks

Important

The XAML syntax for all properties that use a TransitionCollection value is unusual in that you must declare an explicit TransitionCollection object element as the value, and then provide object elements as child elements of TransitionCollection for each of the transition animations you want to use. For most other XAML collection properties you could omit the collection object element because it can be implicit, but properties that use TransitionCollection don't support the implicit collection usage. For more info on implicit collections and XAML, see XAML syntax guide.

Transition animations play a particular role in UI design of your app. The basic idea is that when there is a change or transition, the animation draws the attention of the user to the change.

ChildrenTransitionsProperty ChildrenTransitionsProperty ChildrenTransitionsProperty

Identifies the ChildrenTransitions dependency property.

public static DependencyProperty ChildrenTransitionsProperty { get; }public static DependencyProperty ChildrenTransitionsProperty { get; }Public Static ReadOnly Property ChildrenTransitionsProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the ChildrenTransitions dependency property.

Attributes

IsItemsHost IsItemsHost IsItemsHost

Gets a value that indicates whether this Panel is a container for UI items that are generated by an ItemsControl.

public bool IsItemsHost { get; }public bool IsItemsHost { get; }Public ReadOnly Property IsItemsHost As bool
Value
bool bool bool

true if this instance of Panel is an items host; otherwise, false. The default is false.

Attributes

Remarks

IsItemsHost is a calculated property where the value results from the system checking the parents of the Panel for an ItemsControl implementation. If one exists, then the value is true.

In previous frameworks this property was settable. It's not settable in the Windows Runtime, and there should be no need to set it because the system has the calculation behavior. If you want a different relationship between a panel and a parent items control, just create it that way in your XAML control compositing.

IsItemsHostProperty IsItemsHostProperty IsItemsHostProperty

Identifies the IsItemsHost dependency property.

public static DependencyProperty IsItemsHostProperty { get; }public static DependencyProperty IsItemsHostProperty { get; }Public Static ReadOnly Property IsItemsHostProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsItemsHost dependency property.

Attributes

See Also