Share via


IXRVisualHost::GetRootElement (Windows Embedded CE 6.0)

1/6/2010

This method retrieves the top-level user-interface (UI) element in the element tree that is hosted by this visual host.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetRootElement(
    IXRFrameworkElement** ppRoot
) = 0;

Parameters

  • ppRoot
    [out] Address of a pointer to an IXRFrameworkElement that represents the top-level UI element of the tree that is being hosted.

Return Value

Returns an HRESULT that indicates success or failure.

Returns XR_E_INVALID_THREAD_ACCESS if this method was called from a thread different from the thread on which the system was initialized. A visual host can only be accessed on the thread that it was created on. Notice that most Silverlight for Windows Embedded APIs can only be accessed from a single thread.

Returns XR_E_INVALID_STATE if this method was called on an object in an invalid state, such as a host that was already destroyed, or a dialog that was closed without calling EndDialog.

Remarks

This method adds a reference on the object returned in ppRoot, which the caller is responsible for releasing.

You can traverse the element tree, access elements, or modify elements by using methods on the IXRFrameworkElement object returned in ppRoot. For example, you can locate a named object in the tree by calling IXRFrameworkElement::FindName. Then, you can add event handlers to events for that object by calling the event-related methods such as IXRUIElement::AddGotFocusEventHandler and IXRButtonBase::AddClickEventHandler.

.NET Framework Equivalent

None.

Requirements

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

See Also

Reference

IXRVisualHost