Reputation: 31
I am doing this:
private void dataGrid1_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) {
Person newPerson = ((Person)dataGrid1.SelectedItem);
foreach (Person person in lista)
{
if(person.Id == newPerson.Id)
{
person.Name = newPerson.Name;
person.Salary = newPerson.Salary;
}
}
}
but when I press "enter" after editing a row, the name isnt changed at newPerson object. I think it's because this event is "Ending", and not "ended".
I already binded the thing in mode twoWay. Like this:
<DataGridTextColumn Binding="{Binding Name, Mode=TwoWay}" Header="Name"></DataGridTextColumn>
Upvotes: 2
Views: 512
Reputation: 2387
The event name is RowEditEnding. Just make sure the event handler name in your XAML matches the name of the handler in your code behind. That being said, you would get an exception if you didn't have the names matching up.
Upvotes: 1