Partager via


IXRApplication (Windows Embedded CE 6.0)

1/6/2010

This class represents a singleton object that runs a Silverlight application.

This class also supports methods on the IUnknown interface.

Syntax

class IXRApplication : public IUnknown

Methods

Method Description

IXRApplication::AddResourceModule

Adds this module for Silverlight to use when it automatically resolves Image Source URIs as presented in the source XAML.

IXRApplication::CreateHostFromElementTree

Creates a visual host that hosts an existing element tree so that the application 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(IID,Object)

Creates a new object outside the element tree. This element can be later added to an existing element tree by using the IXRUIElementCollection class.

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 IBitmapImage object for use by the resource manager.

IXRApplication::LoadImageFromResource

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

IXRApplication::LoadResourceDictionary

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

IXRApplication::ParseXaml

Parses the specified source XAML into a dependency object. This dependency 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 with an object tag.

IXRApplication::RegisterDependencyProperty

Registers a dependency property for a user-defined control.

IXRApplication::RegisterResourceManager

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

IXRApplication::RemoveResourceModule

Removes this module from the automatic resolution cache that belongs to Silverlight.

IXRApplication::StartProcessing

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

IXRApplication::StopProcessing

Stops processing messages for this thread.

Remarks

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

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

To traverse the object 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 element tree.

XAML elements from the source XAML file are represented by IXRDependencyObject objects in the object tree. All IXRDependencyObject derived objects support the interface IUnknown. Therefore, to locate an element in the object tree, the x:Name attribute that the UI designer defined for the element in the XAML markup can be supplied in a call to IXRFrameworkElement::FindName. You should be aware that IXRFrameworkElement derives from IXRDependencyObject.

When you have found an object, you can obtain an interface pointer to it by calling IUnknown::QueryInterface on the returned object and supply the desired IID (for example, IID_IXRButton). Now, you can access that object by using the C++ methods on the class that you have a pointer for. This lets you manipulate collections of objects, add items, remove items, or change dependency properties by using the objects in Silverlight.

After you load the element tree, you must attach delegates to the controls that currently can be accessed in the generated object 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 user entry point into the Silverlight system. This singleton object loads the Platform Adaptation Layer (PAL) and the Microsoft Silverlight 2 presentation core.

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

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

.NET Framework Equivalent

None.

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

Classes for Application Management