views:

28

answers:

1

I'm learning WPF, and am wondering if there's an idiomatic way to create a label that, when clicked, toggles a checkbox or radio button. I was somewhat surprised that the Target attribute on Label doesn't do this. I am using the MVVM pattern (with the MVVMFoundation framework.)

A: 

The target property sets the focus to the target element when the labels pre-defined access key is pressed so does not do what you want.

Off the top of my head I would suggest creating a button and using a Style to make it look like a label. You can add 'content' to a checkbox though and this will check the box when clicked.

Leom Burke