Share via


IXamlDirect.GetXamlDirectObject(Object) Method

Definition

Gets the instance as an IXamlDirect for a given XAML type.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 Platform::Object ^ GetXamlDirectObject(Platform::Object ^ object);
IInspectable GetXamlDirectObject(IInspectable const& object);
public object GetXamlDirectObject(object object);
Public Function GetXamlDirectObject (object As Object) As Object

Parameters

object
Object

Platform::Object

IInspectable

Refers to the specific XAML type (typically, but not always, a DependencyObject.

Returns

Object

Platform::Object

IInspectable

Returns the IXamlDirect instance.

Examples

The following example shows how to get the IXamlDirect instance from a full XAML type.

XamlDirect xd = XamlDirect.GetDefault();

Border border = new Border();
IXamlDirect borderXDO = xd.GetXamlDirectObject(border);
XamlDirect^ xd = XamlDirect::GetDefault();

Border^ border = ref new Border();
IXamlDirect^ borderXDO = xd->GetXamlDirectObject(border);

Remarks

Use this method to convert from a full XAML type to its XamlDirect instance and then get the performance benefits of XamlDirect through property management, collection management and event handling functionalities exposed through the XamlDirect APIs.

Applies to

See also