IXamlDirect.GetXamlDirectObject(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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.