Share via

XamlUIPresenter Class


Enables presenting a visual tree on a Microsoft Direct3D surface. This type is used for design tool hosting scenarios and is not intended for general use.

public ref class XamlUIPresenter sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.UI.Xaml.Hosting.HostingContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class XamlUIPresenter final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.UI.Xaml.Hosting.HostingContract), 65536)]
public sealed class XamlUIPresenter
Public NotInheritable Class XamlUIPresenter
Object Platform::Object IInspectable XamlUIPresenter

Windows requirements

Device family
Windows Desktop Extension SDK (introduced in 10.0.10240.0)
API contract
Windows.UI.Xaml.Hosting.HostingContract (introduced in v1.0)


XamlUIPresenter is not intended for general Microsoft DirectX and Windows Runtime interoperation scenarios. You cannot use this API in a UWP app that you submit to the Microsoft Store, it will not pass certification.

For techniques for XAML-Microsoft DirectX interoperation functionality, instead see DirectX and XAML interop.

XamlUIPresenter is specifically intended for interoperation with designer surfaces that represent Windows Runtime objects or their XAML markup as graphical objects in a Microsoft DirectX UI.

XamlUIPresenter has no constructor in the Windows Runtime. To get an instance of XamlUIPresenter you must invoke a Component Object Model (COM) function (CreateXamlUIPresenter) as exported from a Windows Runtime DLL. For example, as part of a C# application you can import the Component Object Model (COM) library:

[DllImport("windows.ui.xaml.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
public static extern void CreateXamlUIPresenter(
    IViewObjectPresentNotifySite presentSite, out Windows.UI.Xaml.Hosting.XamlUIPresenter presenter



Gets or sets a value that determines whether the host wants timelines to always run to end.


Gets or sets the root visual element to draw to the surface.


Gets or sets the string key that identifies the theme set to use from ThemeResourcesXaml.


Gets or sets the XAML that specifies a resource dictionary. The resource dictionary contains themes that the host should resolve and that should be applied to the content.


GetFlyoutPlacement(Rect, Size, Size, Rect, FlyoutPlacementMode, Boolean, FlyoutPlacementMode)

Invokes the FlyoutBase placement logic, using a suggested size of a control that will show a placement target and its flyout. Returns the bounds that are the result of running the placement logic.

GetFlyoutPlacementTargetInfo(FrameworkElement, FlyoutPlacementMode, FlyoutPlacementMode, Boolean)

Returns calculated bounds of a placement target that is intended to also display a flyout in the host. Additional out parameters provide more info on how the bounds were calculated.


Invokes the SizeChanged event on Window.Current. Used by hosts to propagate size changes from host settings to user code, so that a design mode interaction can be differentiated from a run time interaction.


Presents the surface, as a synchronous call for the host.


Renders the surface. Intended for asynchronous calls via a timer.


Specifies the IXamlUIPresenterHost service implementation to use for application resource resolution.

SetSize(Int32, Int32)

Specifies the width and height of the surface.

Applies to