XamlDirect.AddToCollection(IXamlDirectObject, IXamlDirectObject) 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.
Adds a value to the specified IXamlDirectObject collection.
public:
virtual void AddToCollection(IXamlDirectObject ^ xamlDirectObject, IXamlDirectObject ^ value) = AddToCollection;
void AddToCollection(IXamlDirectObject const& xamlDirectObject, IXamlDirectObject const& value);
public void AddToCollection(IXamlDirectObject xamlDirectObject, IXamlDirectObject value);
function addToCollection(xamlDirectObject, value)
Public Sub AddToCollection (xamlDirectObject As IXamlDirectObject, value As IXamlDirectObject)
Parameters
- xamlDirectObject
- IXamlDirectObject
Refers to the specific IXamlDirectObject collection.
- value
- 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.