Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ItemCollection.Insert Method (Int32, Object)

 

Inserts an element into the collection at the specified index.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public void Insert(
	int insertIndex,
	object insertItem
)

Parameters

insertIndex
Type: System.Int32

The zero-based index at which to insert the item.

insertItem
Type: System.Object

The item to insert.

Exception Condition
InvalidOperationException

The item to insert already has a different logical parent.

InvalidOperationException

The collection is in ItemsSource mode.

ArgumentOutOfRangeException

The index is out of range.

All items after the specified position are moved down by one.

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft