I am using MVVM in my WPF4 application.
In my application, the ViewModel has an ObservableCollection ProductsList property, an ICommand Save command property. The Product class has two property: ProductName and Price.
In the UI, the window's DataContext binds to the ViewModel, the xamDataGrid's DataSource binds to the ProductsList property, and a button binds to the Save property.
A user will make change to the Price column in the view.
What I try to do is when the application first fire up, the SAVE button is disabled, since there's nothing new to be saved. As soon as the user makes a change to any record, like changing the price of a Product, the SAVE button will be enabled.
My question is: does xamDataGrid have a property that indicates the bidden data has been changed (so the data grid is dirty)? If there's a such property, I would like to bind this to a property of the ViewModel, for example, bool DataChanged, then I would use this DataChanged property to set the CanExcuteMethod of the "Save" command, to enable the SAVE button.
Or, is there any other way to accomplished this function?
Thank you.