IVisualTreeService::AddChild method (xamlom.h)

Adds a child element to the collection at the specified index.

Syntax

HRESULT AddChild(
  [in] InstanceHandle parent,
  [in] InstanceHandle child,
  [in] unsigned int   index
);

Parameters

[in] parent

A handle to the collection object.

[in] child

A handle to the element to place into the collection. This can be newly created through CreateInstance or shared, such as SolidColorBrush.

[in] index

Location in parent collection at which to insert child element.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

For any collection method, the caller should query the properties of a known element and should only call this method if the property has MetadataBit::IsValueCollectionset.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header xamlom.h

See also

IVisualTreeService