WPF Checkbox handling
I have a class(Owner) which has a property list of a second class(Pet) and vice versa (many to many relationship). It is all connected with a dbcontext.
I am supposed to check checkboxes of pets that a specific owner has. This works and it's storing everything in the database.
The problem I have is when I select an owner, I want to iterate through all the pets for that particular owner and automatically check all the checkboxes for those pets in the list showing.
If I check/uncheck a box through code, the IsChecked on each checkbox (which is bound to a bool property) is triggered and it sets the bool to true or false depending on the currently value (if checked = uncheck and the other way around). This in turn also triggers an add or remove to the list/database which is not what I want since the user never clicked the checkboxes.
I know there is Checked and Unchecked events for checkboxes but I'm supposed to leave the MainWindow.xaml file as empty as possible as it's a part of my assignment.
When using Command it seems like you can't add parameters either.
Any tips/ideas?
Going to try to tackle this tomorrow with a friend!
I am supposed to check checkboxes of pets that a specific owner has. This works and it's storing everything in the database.
The problem I have is when I select an owner, I want to iterate through all the pets for that particular owner and automatically check all the checkboxes for those pets in the list showing.
If I check/uncheck a box through code, the IsChecked on each checkbox (which is bound to a bool property) is triggered and it sets the bool to true or false depending on the currently value (if checked = uncheck and the other way around). This in turn also triggers an add or remove to the list/database which is not what I want since the user never clicked the checkboxes.
I know there is Checked and Unchecked events for checkboxes but I'm supposed to leave the MainWindow.xaml file as empty as possible as it's a part of my assignment.
When using Command it seems like you can't add parameters either.
Any tips/ideas?
Going to try to tackle this tomorrow with a friend!