IXRVisualHost::GetRootElement (Compact 2013)
3/28/2014
This method retrieves the top-level UI element in the element tree of the 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 visual tree of the visual host.
Return Value
Returns S_OK on success; otherwise, returns standard HRESULT values as appropriate or values described below.
Value |
Description |
---|---|
XR_E_INVALID_STATE |
This method was called on an object in an invalid state, such as a host that was already destroyed or a dialog box that was closed without calling EndDialog. |
XR_E_INVALID_THREAD_ACCESS |
This method was called from a different thread than the one on which the system was initialized. A visual host can only be accessed on the thread that it was created on. Most XAML for Windows Embedded APIs can only be accessed from a single thread. |
Remarks
This method adds a reference on the object returned in ppRoot, and the caller is responsible for releasing the reference on the object.
You can traverse the element tree, access elements, or modify elements by using methods on the IXRFrameworkElement object that are 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.
To use a specific interface pointer type, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a derived type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic interface so you do not have to explicitly call IUnknown::QueryInterface to convert the generic interface into the required object type.
.NET Framework Equivalent
None.
Requirements
Header |
XamlRuntime.h |
sysgen |
SYSGEN_XAML_RUNTIME |