0

When I turn on IsCheckable to true multiple checkboxes can be checked. But I want to check only one checkbox at a time within the context Menu. I referred this link -> Mutually exclusive checkable menu items? most of the solutions are non MVVM. I am looking for MVVM , wpf solution

4

1 回答 1

1

The link that you provided is a solution.

Abuse the dependency/attach properties stop pursuing that everything in WPF can be done in MVVM in a clean way. This is the typical mindset of most of the developers when they are coding in WPF.

Note: If you're gonna encounter this problem in another view and you've implemented it using MVVM, then you'll end up having duplicate codes for your ViewModels.

You use dependency/attach properties if you want to reuse the logic for a different view that has exact problem too!

And another side note: Does these checkbox require any of the "Business logic" ViewModel so that there would only be one checkbox checked? If not, then no you're doing it wrong.

"I have to follow the MVVM Pattern, or else I'm not doing it right"

于 2013-08-14T14:46:26.150 回答