开发者

.NET - Doesn't exist an event named RowEditEnded or something for datagrid in WPF?

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 开发者_Python百科this:

<DataGridTextColumn Binding="{Binding Name, Mode=TwoWay}" Header="Name"></DataGridTextColumn>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜