IXamlDirect.GetObject(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 (and creates if necessary) the instance as its full XAML type of the specified IXamlDirect.
This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).
public:
Platform::Object ^ GetObject(Platform::Object ^ xamlDirectObject);
IInspectable GetObject(IInspectable const& xamlDirectObject);
public object GetObject(object xamlDirectObject);
Public Function GetObject (xamlDirectObject As Object) As Object
Parameters
- xamlDirectObject
-
Object
Platform::Object
IInspectable
Refers to the specific IXamlDirect.
Returns
Returns the instance of the full XAML type (typically, but not always, a DependencyObject).
Examples
The following example shows how to convert an IXamlDirect instance pointing to a Border element to its full XAML type.
XamlDirect xd = XamlDirect.GetDefault();
IXamlDirect border = xd.CreateInstance(XamlTypeIndex.Border);
Border borderDO = (Border)xd.GetObject(border);
XamlDirect^ xd = XamlDirect::GetDefault();
IXamlDirect^ border = xd->CreateInstance(XamlTypeIndex::Border);
Border^ borderDO = dynamic_cast<Border^>(xd->GetObject(border));
Remarks
Use this method to convert from a XamlDirect instance to its full XAML type. This results in the creation of a full object and hence the performance benefits of staying within the XamlDirect APIs will be lost for that specific IXamlDirect instance.