How do I attach commands to the checking and unchecking of a CheckBox?

Posted by GraemeF on Stack Overflow See other posts from Stack Overflow or by GraemeF
Published on 2009-06-06T10:31:07Z Indexed on 2010/04/23 8:53 UTC
Read the original article Hit count: 375

Filed under:
|
|
|

In my ViewModel I have two commands:

ICommand ExecuteMeOnCheck { get; }
ICommand ExecuteMeOnUncheck { get; }

I wish to attach these commands to a CheckBox and have one of them execute when it is checked and the other execute when it is unchecked. What's the best way to achieve this without cluttering the View with code-behind?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml