New to Telerik UI for WPF? Download free 30-day trial

Edit an item outside RadGridView

When you edit an item from the collection bound to the RadGridView and the business object implements the INotifyPropertyChanged interface - the changes immediately reflect in the grid. However, this does not update the filtering, grouping and sorting of the control. In order to reapply those operations, you can replace the desired item in the collection bound the ItemsSource of the RadGridView (provided that the collection implements INotifyCollectionChanged) with a new object. Alternatively, you can also invoke the EditItem and CommitEdit methods of the Items collection. Both approaches are demonstrated in Examples 1 and 2.

Example 1: Replace an item in the collection bound to the RadGridView

var newClub = new Club("New Club"); 
 
// In the context of this example this.Clubs is a collection of Club objects, which is bound to the ItemsSource of the RadGridView 
    this.Clubs[0] = newClub; 
Dim newClub = New Club("New Club") 
 
' In the context of this example this.Clubs is a collection of Club objects, which is bound to the ItemsSource of the RadGridView 
Me.Clubs(0) = newClub 

Example 2: Utilize the EditItem and CommitEdit methods of the Items collection

Club selectedItem = this.gridView.SelectedItem as Club; 
this.gridView.Items.EditItem(selectedItem); 
 
selectedItem.Name = "New Name"; 
this.gridView.Items.CommitEdit(); 
Dim selectedItem As Club = TryCast(Me.gridView.SelectedItem, Club) 
Me.gridView.Items.EditItem(selectedItem) 
 
selectedItem.Name = "New Name" 
Me.gridView.Items.CommitEdit() 
In this article