XamlDirect.AddToCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.AddToCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.AddToCollection(IXamlDirectObject, IXamlDirectObject) XamlDirect.AddToCollection(IXamlDirectObject, IXamlDirectObject) Method

Definition

Adds a value to the specified IXamlDirectObject collection.

public : void AddToCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value)
void AddToCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value) const;
public void AddToCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value)
Public Sub AddToCollection(xamlDirectObject As IXamlDirectObject, value As IXamlDirectObject)

Parameters

xamlDirectObject
IXamlDirectObject IXamlDirectObject

Refers to the specific IXamlDirectObject collection.

value
IXamlDirectObject IXamlDirectObject

Refers to the IXamlDirectObject value to add to the collection.

Examples

The following example shows how to add a value to a collection using XamlDirect APIs.

XamlDirect xd = XamlDirect.GetDefault();

IXamlDirectObject relativePanel = xd.CreateInstance(XamlTypeIndex.RelativePanel);

IXamlDirectObject childrenCollection = xd.GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex.Panel_Children);

IXamlDirectObject button = xd.CreateInstance(XamlTypeIndex.Button);
xd.AddToCollection(childrenCollection, button);
XamlDirect^ xd = XamlDirect::GetDefault();

IXamlDirectObject^ relativePanel = xd->CreateInstance(XamlTypeIndex::RelativePanel);

IXamlDirectObject^ childrenCollection = xd->GetXamlDirectObjectProperty(relativePanel, XamlPropertyIndex::Panel_Children);

IXamlDirectObject^ button = xd->CreateInstance(XamlTypeIndex::Button);
xd->AddToCollection(childrenCollection, button);

Remarks

IXamlDirectObject is the minimal handle to Xaml's internal object instances. Hence the collection and the value to add to the collection are both of type IXamlDirectObject.