开发者

Click on label to select radiobutton in WPF with MVVM

I'm learning WPF, and am wondering if there's an idiomatic 开发者_如何学Pythonway 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.)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜