ListCollectionView.AddNewItem Method (Object)

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Adds the specified object to the collection.

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

public object AddNewItem(
	object newItem
)

Parameters

newItem
Type: System.Object

The object to add to the collection.

Return Value

Type: System.Object

The object that was added to the collection.

Exception Condition
InvalidOperationException

An object cannot be added to the ListCollectionView by using the AddNewItem method.

Calling the AddNewItem method starts an add transaction. You should call the CommitNew or CancelNew methods to end the add transaction. A new item always appears in the collection view. Any filtering, sorting, or grouping that is applied to the view is applied to the new item when CommitNew is called.

.NET Framework
Available since 4.0
Return to top
Show: