# Events

This topic will describe the various events exposed by **RadDataForm**.

* **AutoGeneratingField**: Occurs when a data field is being generated. The **AutoGeneratingFieldEventArgs** of the handler have the following properties:
  * **DataField**: The field about to be generated.
  * **Order**: The display order of the new field in RadDataForm.
  * **PropertyName**: The name of the property for which a field is being generated.
  * **PropertyType**: The type of the property for which a field is being generated.
  * **Cancel**: Setting this to True will cancel the generation of this field.

* **CurrentItemChanged**: Occurs when the current item of the control has changed.

* **AddingNewItem**: Occurs when a new item is being added. You can use this to cancel the process of adding a new item when a specific condition is met.

* **InitializingNewItem**: Occurs when a new item is being added but after the **AddingNewItem** event. You can use this to set initial values for the initialized objects by passing an instance to the **InitializingNewItemEventArgs**' **DataItem** property.

* **AddedNewItem**: Occurs when a new item was just added.

* **BeginningEdit**: Occurs when an edit operation on the current item is beginning. You can use this to cancel the process of editing an item when a specific condition is met.

* **ValidatingItem**: Occurs when the current item is being validated.

* **EditEnding**: Occurs when the edit of the current item is ending. The **EditAction** property of the **EditEndedEventArgs** is of type **EditAction** and has a value either **Commit** or **Cancel**. You can use this to handle your custom logic.

* **EditEnded**: Occurs after the current item was edited. Similarly to the **EditEnding** event, you can get ahold of the **EditAction** and use it accordingly.

* **DeletingItem**: Occurs on deleting the current item. You can use this to cancel the process of deleting an item when a specific condition is met.

* **DeletedItem**: Occurs after the current item was deleted. Through the **ItemDeletedEventArgs** you can get ahold of the **DeletedItem** which will hold the removed item.

The following events are fired only if the EditMode of the control is set to **Single**:

* **DataFieldBeginningEdit**: Occurs when an edit operation on a data field is beginning. Through the **DataFieldCancelEventArgs** you can get ahold of the **DataFormDataField** for which the event was fired and also **cancel** the edit operation according to your custom logic.

* **DataFieldPreparedEditor**: Occurs when an edit operation on a data field has begun. Through the **DataFieldPreparedEditorEventArgs** you can get ahold of the **DataFormDataField** for which the event was fired and also access the **editor** that was prepared for the edit operation.

* **DataFieldValidating**: Occurs on deleting the current item. Through the **DataFieldValidatingEventArgs** you can get ahold of the **DataFormDataField** for which the event was fired and also set the following properties:
  * **IsValid**: Indicates whether the changes are valid.
  * **ValidationResults**: A read-only collection of [ValidationResult](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.validationresult) objects.
  * **NewValue**: The new value of the data field.
  * **OldValue**: The old value of the data field.

* **DataFieldValidated**: Occurs when the value of a data field is validated. Through the **DataFieldValidatedEventArgs** you can get ahold of the **DataFormDataField** for which the event was fired and also get a collection of [ValidationResult](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.validationresult) objects.

* **DataFieldEditEnded**: Occurs when an edit operation on a data field has ended. Through the **DataFieldEditEndedEventArgs** you can get ahold of the **DataFormDataField** for which the event was fired and also set the following properties:
  * **EditAction**: The EditAction of the edit operation which can be either **Commit** or **Cancel**.
  * **NewValue**: The new value of the data field.
  * **OldValue**: The old value of the data field.

## See Also

* [Autogenerated Fields](https://www.telerik.com/products/wpf/documentation/controls/raddataform/getting-started/autogenerated-fields)

* [Add, Edit and Delete Operations](https://www.telerik.com/products/wpf/documentation/controls/raddataform/features/add-edit-delete-buttons)

* [Property Level Validation](https://www.telerik.com/products/wpf/documentation/controls/raddataform/validation/validation)
