WPF DataGrid TwoWay Binding

data-binding, wpf, xaml

Solution

You could try and set the `UpdateSourceTrigger`:

<DataGrid ItemsSource="{Binding UsersSet, 
                        Mode=TwoWay, 
                        UpdateSourceTrigger=PropertyChanged}" 
          AutoGenerateColumns="True">

</DataGrid>

Without knowing the rest of your code it is pretty hard to guess.

Problem

I have property `UserSet` which contains from `ObservableCollection<GridRow>`. `GridRow` - my class, which contains 4 properties like this: ``` public int Id { get { return id; } set { id = value; RaisePropertyChanged("Id"); } } ``` I populate UserSet, then Grid binds to it. When I change `id` field works setter `Id`. It sets right values. But, after all changes, when I click other button my `UserSet` has not modified values. So I can't get updated Grid. This is my XAML: ``` <DataGrid ItemsSource="{Binding UsersSet, Mode=TwoWay}" AutoGenerateColumns="True"> </DataGrid> ``` Please help.

Original source