Creates a layer of native Controls on top of a GraphicsView. Controls in its subtree will be mapped to the native controls provided by the OS.

A Fuse App contains an implicit GraphicsView at the root level, which ensures that UI components are renderered using high performance OpenGL graphics by default.

To display native stock controls that are bundled with the platform's OS, you can use a NativeViewHost. Some Controls are only available as native Controls (e.g. WebView or MapView), while others are available as both native and graphics Controls (e.g. ScrollView or Rectangle).

Note: Native Controls are always rendered in front of graphics controls.

The only exception is when Fuse.Controls.NativeViewHost.RenderToTexture is enabled, which comes with its own set of limitations.

Examples

WebView is only available as a native view. Here's how to display one:

<Panel>
    <NativeViewHost>
        <WebView Url="http://example.com" />
    </NativeViewHost>
</Panel>

We can also layer native Controls over each other and form heirarchies within the NativeViewHost, just like with regular UX markup:

<Panel>
    <NativeViewHost>
        <Panel Alignment="Top" Padding="15" Color="#0006">
            <Text>This text is layered on top of the WebView</Text>
        </Panel>
        <WebView Url="http://example.com" />
    </NativeViewHost>
</Panel>

You can use the RenderToTexture property to render the native view to a texture to enable correct layer-compositing with other graphics-based Visuals. Note that this comes at a performance cost, and native views are not interactive while being rendered to texture.

<Text Alignment="Center">This text is layered on top of the NativeViewHost</Text>
<NativeViewHost RenderToTexture="true">
    <Rectangle Color="#324" />
</NativeViewHost>

To make an app consisting solely of native components, place a <NativeViewHost> at the root level of your app:

<App>
    <NativeViewHost>
        <!-- entire app goes here -->
    </NativeViewHost>
</App>

Location

Namespace
Fuse.Controls
Package
Fuse.Controls.Panels 2.9.1
Show Uno properties and methods

Interface of NativeViewHost

RenderToTexture : bool ux

Whether to render the contents to a texture to enable layered compositing with graphics.

Inherited from LayoutControl

Inherited from Control

Inherited from Element

ActualPosition : float2 uno

The position of the element, the position of its top-left corner to the top-left corner in the parent.

Anchor : Size2 ux

A point within the element to treat as its "epicenter".

Aspect : float ux

The aspect ratio that an element must fulfill in layout.

Offset : Size2 ux

Offets the position of the element after all other layout has been applied.

Inherited from Visual

bringIntoView() js

Requests that this visual be brought into the visible are of the screen. Typically a containing ScrollView will scroll to ensure it is visible.

Children : IList of Node ux

The children of the visual. All nodes placed inside the visual in UX markup are assigned to this list. The order of Visuals this list determines the order of layout. The Z-order of the children is by default equal to this order, but can be manipulated separately using methods like BringToFront and SendToBack.

InvalidateVisual uno

Indicates the visual for this node has changed. This allows the root-level node to know that it must draw, and any caching that it must invalidate the cache for this node.

InvalidateVisualComposition uno

Indicates the composition of the visual has changed, but that the visual drawing itself is still valid (for example a position change).

IsEnabled : bool ux

Whether this node is currently interactable. Disabled visuals do not receive input focus. However, they can still be visible and block hit test for underlaying objects.

IsLocalVisible : bool uno

Returns whether this visual is visible without concern for whether an ancestor visual is hidden or collapsed.

IsVisible : bool uno

Returns whether this visual is currently visible. Will return false if any of the ancestor visuals are hidden or collapsed. This property can not be used to check whether a visual is hidden because it is occluded by another visual, or is outside the view but otherwise visible.

Parameter : string ux

The parameter data for this visual, encoded as JSON, provided by a router if this visual represents a navigation page.

SnapToPixels : bool ux

Whether to snap the result of layout of this visual to physical device pixels.

ZOffset : float ux

Specifies a Z-Offset, visuals with higher values are in front of other visuals.

Inherited from Node

ContextParent : Node uno

The context parent is the semantic parent of this node. It is where non-UI structure should be resolved, like looking for the DataContext, a Navigation, or other semantic item.

FindNodeByName(Selector, Predicate<Node> (Node)) : Node uno

Finds the first node with a given name that satisfies the given acceptor. The serach algorithm works as follows: Nodes in the subtree are matched first, then it matches the nodes in the subtrees ofthe ancestor nodes by turn all the way to the root. If no matching node is found, the function returns null.

IsRootingStarted : bool uno

Whether rooting of this node has started. Note that even if this property returns true, rooting may not yet be completed for the node. See also IsRootingCompleted.

Name : Selector ux

Run-time name of the node. This property is automatically set using the ux:Name attribute.

OnRooted uno

If you override OnRooted you must call base.OnRooted() first in your derived class. No other processing should happen first, otherwise you might end up in an undefined state.

Inherited from PropertyObject

Inherited from object

Attached UX Attributes

Items (attached by Each) : object ux

The item collection that will be used to populate this visual.

MatchKey (attached by Each) : string ux

Shorthand for setting the MatchKey property on the implicit Each created when using the Items attached property.

Column (attached by Grid) : int ux

The index of the column the element occupies while in a Grid. If not set, the grid will place the element in a cell according to its position in the child list.

Row (attached by Grid) : int ux

The index of the row the element occupies while in a Grid. If not set, the grid will place the element in a cell according to its position in the child list.

GlobalKey (attached by Resource) : string ux

The ux:Global attribute creates a global resource that is accessible everywhere in UX markup.

Implemented Interfaces

IScriptObject uno

Interface for objects that can have a script engine representation