Export (0) Print
Expand All

IXRApplication (Compact 2013)

3/28/2014

This class represents a singleton object that runs a XAML for Windows Embedded application.


class IXRApplication : public IUnknown

IUnknown

    IXRApplication

Method

Description

IXRApplication::AddResourceModule

Adds this module for XAML for Windows Embedded to use when it automatically resolves image source URIs as presented in the source XAML.

IXRApplication::CreateControlByName

Uses the factory you registered to create an instance of a custom user control by using the provided control name.

IXRApplication::CreateHostFromElementTree

Creates a visual host that hosts an existing element tree so that the code in the application instance can access or modify the elements in that tree.

IXRApplication::CreateHostFromXaml

Parses the source XAML, generates an element tree, and instantiates a visual host that hosts the element tree, so that an application can access or modify the elements in that tree.

IXRApplication::CreateObject

Creates a new object outside the element tree.

IXRApplication::GetLayoutInformation

Retrieves additional information about the layout of an object in your application.

IXRApplication::GetResourceDictionary

Retrieves the top-level IXRResourceDictionary object that is being used to resolve {StaticResource} bindings while parsing XAML.

IXRApplication::LoadImageFromFile

Loads a bitmap image from a local file and creates an IWICBitmap object for the resource manager to use.

IXRApplication::LoadImageFromResource

Loads a bitmap image from a binary resource and creates an IWICBitmap object for the resource manager to use.

IXRApplication::LoadResourceDictionary

Parses the specified XAML file that contains the resources that belong to the application.

IXRApplication::ParseXaml

Parses the specified source XAML into a XAML for Windows Embedded object. This XAML for Windows Embedded object can be inserted into an existing element tree, or it can become the root of a new element tree hosted by a visual host.

IXRApplication::ParseXamlWithExistingRoot

Parses the source XAML and adds it to an existing root in the visual tree.

IXRApplication::RegisterAttachedProperty

Registers an attached property for a user-defined control.

IXRApplication::RegisterControl

Registers a user-defined control that will be defined in source XAML by using an object tag.

IXRApplication::RegisterControlFactory

Registers a custom factory object to use to create instances of custom user controls in the specified XML namespace.

IXRApplication::RegisterDependencyProperty

Registers a dependency property for a user-defined control.

IXRApplication::RegisterResourceManager

Registers an instance of IXRResourceManager to use whenever this application attempts to load resources.

IXRApplication::RegisterXamlObject

Registers a native Visual C++ object that XAML for Windows Embedded creates when the specified XAML tag is encountered during the parsing of an XAML file.

IXRApplication::RemoveResourceModule

Removes this module from the automatic resolution cache that belongs to XAML for Windows Embedded.

IXRApplication::StartProcessing

Starts processing messages for this thread and for all OS windows on this thread. It does not return until IXRApplication::StopProcessing is called.

IXRApplication::StopProcessing

Stops processing messages for this thread.

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.

This class also supports methods on the IUnknown interface.

You can retrieve the IXRApplication object instance by first calling XamlRuntimeInitialize, creating an IXRApplication object instance, and then passing the address of a pointer to that IXRApplication object into a call to GetXRApplicationInstance.

You must also use the IXRApplication instance to create a visual host by first parsing the source XAML and generating a visual tree from the XAML, which you can then access programmatically at run time. You can do this by calling IXRApplication::CreateHostFromXaml.

To use the visual tree, you must first obtain a pointer to the IXRVisualHost object, which is retrieved by IXRApplication::CreateHostFromXaml. Then, you can call IXRVisualHost::GetRootElement to obtain the root element of the generated visual tree.

XAML elements from the source XAML file are represented by IXRDependencyObject derived objects in the visual tree. All IXRDependencyObject derived objects support the interface IUnknown. To locate an element in the visual tree, the x:Name attribute that the user interface (UI) designer defined for the element in the XAML markup can be supplied in a call to IXRFrameworkElement::FindName.

After you load the visual tree, you must attach delegates to the controls that currently can be accessed in the visual tree. To do this, you must obtain a pointer to the object and call the event model methods on that object to attach delegates. Each UI object that raises events also has event model methods that relate to the events that they raise. All event model methods are prefaced with Add or Remove. Examples include IXRUIElement::AddGotFocusEventHandler, IXRUIElement::RemoveGotFocusEventHandler, IXRButtonBase::AddClickEventHandler, and IXRButtonBase::RemoveClickEventHandler.

To release an IXRApplication instance, you must call XamlRuntimeUninitialize.

The IXRApplication object provides the entry point into the XAML for Windows Embedded system. This singleton object loads the Microsoft Silverlight 3 presentation core module.

There is only one IXRApplication object per application, and there is only one instance of the Silverlight 3 presentation core module per application. Therefore, IXRApplication is responsible for all global functionality for an application, including resolving resources such as images and multimedia, handling callbacks from the single internal instance of the Silverlight 3 presentation core module, and managing the object model cache.

In addition, IXRApplication provides the application with access to the top-level functionality supported by the Silverlight 3 presentation core module, such as parsing XAML markup, creating objects, and so on.

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

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

Show:
© 2014 Microsoft