| Visual Basic (Declaration) | |
|---|---|
Public Event CreatingNewItem() As EventHandler(Of DataGridCreatingNewItemEventArgs) | |
| C# | |
|---|---|
public event EventHandler<DataGridCreatingNewItemEventArgs> CreatingNewItem() | |
If the insertion of new items is to be handled manually, a new item must be provided and the Handled property set to true to indicate that the process will be handled manually. If a new item is provided but the Handled property was not set or was set to false, the item will be ignored and an attempt will be made by the DataGridCollectionView to create a new item. An InvalidOperationException will be thrown if the Handled property is set to true but a new item is not provided.
Manually handling the insertion of new items requires that the CreatingNewItem, CommitingNewItem, and CancelingNewItem events must all be handled otherwise an InvalidOperationException will be thrown.
The new item should be added to the underlying data source in the CommitingNewItem event rather than the CreatingNewItem event.
Supported Frameworks: Microsoft .NET Framework version 3.5