Panel Panel Panel Class

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

Syntax

Declaration

public class Panelpublic class PanelPublic Class Panel

Inheritance Hierarchy

Inherited Members

Inherited properties

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , ,

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 summary

Provides base class initialization behavior for Panel derived classes.

Properties summary

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

Identifies the Background dependency property.

Gets the collection of child elements of the panel.

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

Identifies the ChildrenTransitions dependency property.

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

Identifies the IsItemsHost dependency property.

Constructors

  • Panel()
    Panel()
    Panel()
    Panel()

    Provides base class initialization behavior for Panel derived classes.

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

Properties

  • Background
    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 Brushpublic Brush Background { get; set; }
    <panel Background="{StaticResource resourceName}"/>
    
    

    Property Value

    • The brush that fills the panel content area. The default is null, (a null brush) which is evaluated as Transparent 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 Background property of the template parent (the control class that uses your template).

  • BackgroundProperty
    BackgroundProperty
    BackgroundProperty
    BackgroundProperty

    Identifies the Background dependency property.

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

    Property Value

  • Children
    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 UIElementCollectionpublic UIElementCollection Children { get; }
    <panel>
      oneOrMoreUIElements
    </panel>
    

    Property Value

  • ChildrenTransitions
    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 TransitionCollectionpublic TransitionCollection ChildrenTransitions { get; set; }
    <panel>
      <panel.ChildTransitions>
        <TransitionCollection>
          oneOrMoreTransitions
        </TransitionCollection>
      </panel.ChildTransitions>
    </panel>
    

    Property Value

    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
    ChildrenTransitionsProperty

    Identifies the ChildrenTransitions dependency property.

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

    Property Value

  • IsItemsHost
    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 boolpublic bool IsItemsHost { get; }

    Property Value

    • bool
      bool
      bool

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

    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
    IsItemsHostProperty

    Identifies the IsItemsHost dependency property.

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

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.UI.Xaml.Markup.ContentPropertyAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll