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.
New to Telerik UI for WPF?
Download free 30-day trial
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.
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.
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.
Get more information about the edit events here.
Delete Event
Get more information about the delete events here.
Validation Events
Get more information about the validation events here.
Filtering Events
Get more information about the filtering events here.
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.
Get more information about the sorting events here
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
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.
Get more information about the grouping events here.
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.
Get more information about the exporting events here.
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.
Get more information about the column resizing events here
Other
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
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
private void ClubsGrid_RowIsExpandedChanging(object sender, Telerik.Windows.Controls.GridView.RowCancelEventArgs e)
{
e.Cancel = true;
}
Both RowIsExpandedChanged and RowIsExpandedChanging occur only when there is Hierarchy defined and won't be applied if using the RowDetailsTemplate property with another RadGridView.
GridViewColumn
Sorting
-
SortingStateChanged: Occurs when the sorting state of the column is changed. The type of the passed event arguments is RadRoutedPropertyChangedEventArgs
.
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.
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.
Other
- IsExpandedChanged: Occurs when GridViewRow changes its IsExpanded state. The type of the passed event arguments is RoutedEventArgs.
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.
Edit Events
-
IsEditorVisibleChanged: Occurs when the cell editors has visibility changed. The type of the passed event arguments is RoutedPropertyChangedEventArgs
.