次の方法で共有


IXRPanel (Compact 2013)

3/28/2014

This C++ class provides a base class for all panel elements. You can use panel elements as containers to position and arrange child objects in your XAML for Windows Embedded based application.

Syntax

class IXRPanel : public IXRFrameworkElement

Inheritance Hierarchy

IXRDependencyObject

    IXRUIElement

        IXRFrameworkElement

            IXRPanel

                IXRGrid

                IXRStackPanel

                IXRCanvas

                    IXRInkPresenter

Methods

Method

Description

IXRPanel::GetBackground

Retrieves the brush that is used to fill the panel.

IXRPanel::GetChildren

Retrieves the collection of child elements of the panel.

IXRPanel::GetIsItemsHost

Returns true if this instance of IXRPanel is a container for UI elements generated by an IXRItemsControl; otherwise, returns false.

IXRPanel::SetBackground

Sets the brush to use to fill the panel.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

To position elements in your application UI, you must put them in an object derived from a panel. The intermediate base class IXRPanel has defined layout behavior that determines onscreen positioning of your object.

The term layout describes the process of sizing and positioning the members of a panel element's collection of child elements and then drawing them on the screen. You can obtain a pointer to this collection by calling IXRPanel::GetChildren. To provide support for complex layouts, XAML for Windows Embedded currently implements panel elements such as IXRCanvas, IXRGrid, IXRItemsControl, andIXRStackPanel. IXRGrid is the most flexible and powerful layout element.

In addition to positioning child objects within panel objects, you can position panel objects within other panel objects. To do this, you must add the child panel object to the object collection. You can retrieve this collection by using the IXRPanel::GetChildren method.

You can access an existing IXRPanel object in the visual tree by obtaining a pointer to a visual host, retrieving the host's root element, traversing the element tree, and then calling IUnknown::QueryInterface on a named object in the visual tree. Or, you can create a new panel element and insert it into a generated visual tree, as an alternative to declaring it in the source XAML for your application.

When you create a class instance, use an IXRPanelPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also declare a panel object in XAML for Windows Embedded XAML by using the <StackPanel>, <Grid> or <Canvas> XAML elements. Each XAML element represents an object derived from IXRPanel. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see IXRCanvas, IXRGrid, or IXRStackPanel.

.NET Framework Equivalent

System.Windows.Controls.Panel

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for UI Element Management