-api-id | -api-type |
---|---|
M:Microsoft.UI.Xaml.Core.Direct.IXamlDirect.RemoveFromCollectionAt(System.Object,System.UInt32) |
winrt method |
Attempts to remove a value from the IXamlDirect collection at the specified index.
This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).
Refers to the specific IXamlDirect collection.
Refers to the index in the collection where the value must be removed.
IXamlDirect.InsertIntoCollectionAt(System.Object,System.UInt32,System.Object), IXamlDirect.AddToCollection(System.Object,System.Object), IXamlDirect.RemoveFromCollection(System.Object,System.Object), IXamlDirect.ClearCollection(System.Object)
The following example shows how to remove a value from a specific index using XamlDirect APIs.
XamlDirect xd = XamlDirect.GetDefault();
IXamlDirect relativePanel = xd.CreateInstance(XamlTypeIndex.RelativePanel);
IXamlDirect childrenCollection = xd.GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex.Panel_Children);
xd.RemoveFromCollectionAt(childrenCollection, 0);
XamlDirect^ xd = XamlDirect::GetDefault();
IXamlDirect^ relativePanel = xd->CreateInstance(XamlTypeIndex::RelativePanel);
IXamlDirect^ childrenCollection = xd->GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex::Panel_Children);
xd->RemoveFromCollectionAt(childrenCollection, 0);