2

I'm using MVVM in WPF.

In CheckBox control i can bind command to DelegateCommand to trace changes and I can also bind IsChecked property to my ViewModel.

What is better and what is difference between the 2 options?

2 Answers 2

1

Using IsChecked makes more sense to me.

This way you have a bool property in the ViewModel and can react to changes and place your logic in the setter, and avoid the extra boilerplate of the DelegateCommand.

Sign up to request clarification or add additional context in comments.

Comments

1

It depends on what you want to do when the checked state of the check box changes.

If all you care about is if the check box is checked or not, then binding to IsChecked is the right way to go.

If you want to do something in response to the checked state changing, then binding to the command will allow you to easily do something in this case.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.