I have a pretty simple use case: I have a grid populated from a database, with a column for each field.
I want the user to be able to add new records, and to edit existing records.
My problem is the fields that are part of the primary key. I need these to be editable, when the user is adding a new record, but to not be editable, when the user is editing an existing record.
Seems like a pretty common problem, but I've not been able to figure out how to do it.
If it matters, I'm using MVVM and my records are in an ObservableCollection. My ViewModel picks up on changes to the collection with a NotifyCollectionChangedEventHandler on the collection, and changes to individual records with a PropertyChangedEventHandler on each record. I don't actually have any GUI events being handled in the codebehind.
I want the user to be able to add new records, and to edit existing records.
My problem is the fields that are part of the primary key. I need these to be editable, when the user is adding a new record, but to not be editable, when the user is editing an existing record.
Seems like a pretty common problem, but I've not been able to figure out how to do it.
If it matters, I'm using MVVM and my records are in an ObservableCollection. My ViewModel picks up on changes to the collection with a NotifyCollectionChangedEventHandler on the collection, and changes to individual records with a PropertyChangedEventHandler on each record. I don't actually have any GUI events being handled in the codebehind.