IXRUserControl (Compact 2013)

3/28/2014

This class provides the base class for defining a new control that encapsulates related existing controls and provides its own logic.

Syntax

class IXRUserControl : public IXRControl

Inheritance Hierarchy

IXRDependencyObject

    IXRUIElement

        IXRFrameworkElement

            IXRControl

                IXRUserControl

                    IXRCustomUserControlBase

                        IXRCustomUserControl

Methods

Method

Description

IXRUserControl::GetContent

Retrieves the object that represents the content that is displayed inside this control.

IXRUserControl::SetContent

Sets the object that represents the content to display inside this control.

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

You can create a control that inherits from IXRUserControl to achieve the following goals:

  • To separate functionality into smaller, manageable pieces of logic that can be created independently from an application and from other controls.
  • To group related controls that can be used multiple times in an application.

An IXRUserControl is a composite of existing elements. You can add these elements to an IXRUserControl by calling IXRUserControl::SetContent. Because the parameter that is passed into IXRUserControl::SetContent is an IXRUIElement derived object, you typically set it to an element that inherits from the IXRPanel class. Then, you can populate the child elements of IXRPanel by manipulating its collection object, retrieved by calling IXRPanel::GetChildren.

It is common to put an IXRUserControl inside another IXRUserControl as its content. When you create an IXRUserControl that encapsulates a piece of logic, you will usually position that IXRUserControl as the root element of your XAML for Windows Embedded-based application.

Although IXRUserControl inherits the template-related methods from the IXRControl class, you cannot apply a control template to an IXRUserControl.

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

You can also define a user control in Microsoft Silverlight 3 XAML. 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 the UserControl Class on MSDN.

.NET Framework Equivalent

System.Windows.Controls.UserControl

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for UI Element Management