New to Telerik UI for WPF? Start a free 30-day trial
Cancel Invalid Cell Edit on Click Outside of RadGridView
Updated on Mar 17, 2026
Environment
| Product Version | 2019.3.917 |
| Product | RadGridView for WPF |
Description
How to cancel changes in invalid GridViewCell and exit edit mode when another control gets the focus.
Solution
To do this, you can subscribe for the GotFocus event of the control that should steal the focus from RadGridView and in the event handler, call the CancelEdit method of RadGridView.
XAML
<Grid>
<telerik:RadGridView x:Name="radGridView" />
<telerik:RadButton x:Name="cancelEditButton" GotFocus="cancelEditButton_GotFocus"/>
</Grid>
C#
private void cancelEditButton_GotFocus(object sender, RoutedEventArgs e)
{
this.radGridView.CancelEdit();
}