WPF click on label change checkbox isChecked property

You can also do this:

<CheckBox>
    <Label Content="Your text here"/>
</CheckBox>

One limitation though is that the text will have to be on the right side of the checkbox.


Paste this code into kaxaml

You'll see that clicking on the label toggles the checkbox.

[See this SO answer by Kent]

<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel>
    <CheckBox IsChecked="{Binding IsChecked, ElementName=checkbox}" Content="Hello">
        <CheckBox.Template>
            <ControlTemplate TargetType="CheckBox">
                <ContentPresenter/>
            </ControlTemplate>
        </CheckBox.Template>
    </CheckBox>
    <CheckBox x:Name="checkbox" Content="A normal checkbox"/>
</StackPanel>
</Page>