#350 – CheckBox Basics

The CheckBox control allows a user to toggle the state of something in an application.  The user uses the left mouse button to check/uncheck the control, turning something on or off.

You specify a label for each CheckBox using its Content property.

    <StackPanel HorizontalAlignment="Center">
        <Label Content="Things my dog can do:"/>
        <CheckBox Content="Sit"/>
        <CheckBox Content="Stay"/>
        <CheckBox Content="Fetch"/>

The IsChecked property indicates whether a CheckBox is currently checked.  It can be read from or written to.  You can also use data binding to bind the IsChecked property to a boolean variable.

The Checked event fires when a user checks the CheckBox.  The Unchecked event fires when a user unchecks the CheckBox.  The Click event fires whenever the user checks or unchecks the CheckBox.