Hey, I'm new to this subreddit so forgive any mistakes I make.
I'm working on this WPF application and currently I have a form that displays customer information which looks like this.
So the blue button is a save button. As you see I have all of the fields enabled so the user can edit the fields, then click save to make the changes to the database.
I have a command which I would use to save the changes to the database but I'm having trouble binding it correctly.
What I eventually want is for the button to get enabled once the user has made changes to a certain customer and if he/she clicks it, the changes are saved and it should be disabled again, until more changes are made.
I've been wanting to bind the button to the command but I'm not sure how I should check for changes in order to decide whether to enable/disable the button. The customer is an instance of a class which contains a lot of fields like the ones you can see on the screenshot. This means I have to, in some way, detect changes to any of the fields that exist within the customer. I want to do this as clean as I possibly can. I know I could have booleans for each field (or just a global 'HasChanged' boolean) I could set to true every time the user types in a character in one of the fields but this doesn't seem right to me. How would I go about doing this?
btw: I do have a ViewModel that has the currently displayed customer in it.
by syntax1993 via /r/csharp