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.
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 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 is updated or when a data operation (such as sorting, filtering and/or grouping) is performed.
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.
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.
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 for more information.
Delete Event
See Delete Events for more information.
Validation Events
See Validation Events for more information.
Filtering Events
See Filtering Events 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 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.
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 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 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 for more information.
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; }
Both RowIsExpandedChanged and RowIsExpandedChanging occur only when a Hierarchy 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.
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.
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.
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.
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.
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.
GridViewCell Edit Events
- IsEditorVisibleChanged: Occurs when the cell editor's visibility changes. The type of the passed event arguments is
RoutedPropertyChangedEventArgs<bool>.