# Events Overview

This topic covers the specific events exposed by the **RadGridView** control and its sub elements **GridViewColumn**, **GridViewRow** and **GridViewCell**. The events are first grouped by control and then by their general purpose.

## RadGridView

The following sections group RadGridView events by purpose.

<a id="data-events"></a>

### RadGridView Data Events

* **DataLoading**: Occurs before the grid view data is loaded. The type of the passed event arguments is **GridViewDataLoadingEventArgs**. The event is raised when the control is first bound, when its **ItemsSource** is changed or when a [TableDefinition](https://www.telerik.com/products/wpf/documentation/controls/radgridview/hierarchical-gridview/basic-hierarchies#defining-the-gridviewtabledefinition) is updated.

* **DataLoaded**: Occurs when the grid view data is loaded. The type of the passed event arguments is **System.EventArgs**. The event is raised when the control is first bound, when its **ItemsSource** is changed,when a [TableDefinition](https://www.telerik.com/products/wpf/documentation/controls/radgridview/hierarchical-gridview/basic-hierarchies#defining-the-gridviewtabledefinition) is updated or when a data operation (such as sorting, filtering and/or grouping) is performed.

> note The DataLoading and DataLoaded events are triggered when the ItemsSource is changed.

* **BindingValidationError**: Occurs when a data validation error is reported by a binding source. The type of the passed event arguments is **EventArgs**.

* **AddingNewDataItem**: Occurs when a new data item is about to be added. The type of the passed event arguments is **GridViewAddingNewEventArgs**.

<a id="selection-events"></a>

### RadGridView Selection Events

* **CurrentCellInfoChanged**: Occurs when the selected grid cell has changed. The type of the passed event arguments is **GridViewCurrentCellInfoChangedEventArgs**.

* **SelectionChanged**: Occurs when the selected grid row has changed. The type of the passed event arguments is **SelectionChangeEventArgs**.

* **RowActivated**: Occurs when a row is activated - when user double click on it or press enter. The type of the passed event arguments is **RowEventArgs**.

* **RowLoaded**: Occurs anytime the row appears within the view port. The type of the passed event arguments is **RowLoadedEventArgs**.

* **RowUnloaded**: Occurs anytime the row disappears within the view port. The type of the passed event arguments is **RowUnloadedEventArgs**.

<a id="edit-events"></a>

### RadGridView Edit Events

* **RowEditEnded**: Occurs when row validation passed successfully and new data is committed to the **RadGridView**.**ItemsSource**. The type of the passed event arguments is **GridViewRowEditEndedEventArgs**.

* **CellEditEnded**: Occurs when cell validation is passed successfully and new data is committed to the **RadGridView**.**ItemsSource**. The type of the passed event arguments is **GridViewCellEditEndedEventArgs**.

* **BeginningEdit**: Occurs when the cell is about to enter into EditMode. The type of the passed event arguments is **GridViewBeginningEditRoutedEventArgs**.

* **PreparingCellForEdit**: Occurs after the BeginningEdit event. It allows you to obtain a reference to the editing element and change its properties.

* **PreparedCellForEdit**: Occurs after the PreparingCellForEdit event.

See [Edit Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/edit) for more information.

### Delete Event

See [Delete Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/delete) for more information.

### Validation Events

See [Validation Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/validation) for more information.

### Filtering Events

See [Filtering Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/event-model) for more information.

### Sorting Events

* **Sorting**: Occurs when the grid data is about to be sorted. The type of the passed event arguments is **GridViewSortingEventArgs**.

* **Sorted**: Occurs when the grid data has been sorted. The type of the passed event arguments is **GridViewSortedEventArgs**.

See [Sorting Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/sorting/basics#events) for more information.

### Searching Events

* **Searching**: Occurs when the grid data is about to be searched. The type of the passed event arguments is **GridViewSearchingEventArgs** which contains the value of the text which was entered in the search panel **TextBox** - **SearchText**. They also contain a boolean property which indicates whether the event should be canceled - **Cancel**.

* **Searched**: Occurs when the grid data has been searched. The type of the passed event arguments is **GridViewSearchedEventArgs** which contains the value of the text which was entered in the search panel **TextBox** - **SearchText**.

<a id="grouping"></a>

### Grouping Events

* **Grouping**: Occurs when the grid data is about to be grouped. The type of the passed event arguments is **GridViewGroupingEventArgs**.

* **Grouped**: Occurs when the grid data has been grouped. The type of the passed event arguments is **GridViewGroupedEventArgs**.

* **ChildTableDefinitionAdded**: Occurs when a new child table definition has been added. The type of the passed event arguments is **TableDefinitionCreatedEventArgs**.

See [Grouping Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/grouping) for more information.

### Exporting Events

* **ElementExporting**: Occurs when the grid data is being exported. It is a direct replacement of the **Exporting** event.

* **ElementExported**: Occurs after the **ElementExporting** event where you can access the StreamWriter and write additional data to the stream.

* **ElementExportingToDocument**: Occurs when the grid data is being exported to Xlsx or Pdf.

* **ElementExportedToDocument**: Occurs after the ElementExportingToDocument event. Within it you can access the StreamWriter and write additional data to the stream.

See [Export Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/export/events/datacontext) for more information.

### Row Details Events

* **UnloadingRowDetails**: Occurs when the row details are being unloaded. The type of the passed event arguments is **GridViewRowDetailsEventArgs**.

* **RowDetailsVisibilityChanged**: Occurs when the visibility of the row details has changed. The type of the passed event arguments is **GridViewRowDetailsEventArgs**.

* **LoadingRowDetails**: Occurs when the row details are being loaded. The type of the passed event arguments is **GridViewRowDetailsEventArgs**.

### Column Resizing Events

* **ColumnWidthChanging**: Occurs when the column is being resized. Can be canceled. The type of the passed event arguments is **ColumnWidthChangingEventArgs**.

* **ColumnWidthChanged**: Occurs after the resize is complete. The type of the passed event arguments is **ColumnWidthChangedEventArgs**.

See [Column Resizing Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/column-resize-event) for more information.

<a id="other"></a>

### Column Generation and Row Expansion Events

* **AutoGeneratingColumn**: Occurs each time new column is auto generated by the grid view control. The type of the passed event arguments is **GridViewAutoGeneratingColumnEventArgs**.

* **RowIsExpandedChanged**: Occurs when a row's expanded state is changed - when its hierarchy child is expanded or collapsed.

  **Example 1: Shows if the row is expanded**

  The following example checks whether the row is expanded.

  ```C#
  private void ClubsGrid_RowIsExpandedChanged(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
  {
      var row = e.Row as GridViewRow;
      MessageBox.Show(row.IsExpanded.ToString());
  }
  ```

* **RowIsExpandedChanging**: Occurs when a row's expanded state is about to be changed - when its hierarchy child is expanded or collapsed.

  **Example 2: Cancel the expanding**

  The following example cancels row expansion.

  ```C#
  private void ClubsGrid_RowIsExpandedChanging(object sender, Telerik.Windows.Controls.GridView.RowCancelEventArgs e)
  {
      e.Cancel = true;
  }
  ```

> note Both **RowIsExpandedChanged** and **RowIsExpandedChanging** occur only when a [Hierarchy](https://www.telerik.com/products/wpf/documentation/controls/radgridview/hierarchical-gridview/hierachy-overview) is defined. They do not apply when using the **RowDetailsTemplate** property with another **RadGridView**.

## GridViewColumn

The following event reports changes to a column's sorting state.

<a id="sorting"></a>

### Column Sorting Events

* **SortingStateChanged**: Occurs when the sorting state of the column is changed. The type of the passed event arguments is `RadRoutedPropertyChangedEventArgs<SortingState>`.

## GridViewRow

The following sections describe events exposed by GridViewRow.

<a id="data-events-1"></a>

### GridViewRow Data Events

* **BindingValidationError**: Occurs when a data validation error is reported by a binding source. The type of the passed event arguments is **ValidationErrorEventArgs**.

<a id="selection-events-1"></a>

### GridViewRow Selection Events

* **Selected**: Occurs when the grid row is selected. The type of the passed event arguments is **RoutedEventArgs**.

* **Unselected**: Occurs when the grid row is deselected. The type of the passed event arguments is **RoutedEventArgs**.

<a id="other-1"></a>

### Row Expansion Events

* **IsExpandedChanged**: Occurs when **GridViewRow** changes its **IsExpanded** state. The type of the passed event arguments is **RoutedEventArgs**.

## GridViewCell

The following sections describe events exposed by GridViewCell.

<a id="data-events-2"></a>

### GridViewCell Data Events

* **BindingValidationError**: Occurs when a data validation error is reported by a binding source. The type of the passed event arguments is **ValidationErrorEventArgs**.

<a id="edit-events-1"></a>

### GridViewCell Edit Events

* **IsEditorVisibleChanged**: Occurs when the cell editor's visibility changes. The type of the passed event arguments is `RoutedPropertyChangedEventArgs<bool>`.

## See Also

* [Validation Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/validation)
* [Column Resizing Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/column-resize-event)
* [Export Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/export/events/datacontext)
* [Grouping Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/grouping)
* [Sorting Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/sorting/basics#events)
* [Filtering Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/filtering/event-model)
* [Delete Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/delete)
* [Edit Events](https://www.telerik.com/products/wpf/documentation/controls/radgridview/events/edit)
