Three states in WPF's CheckBox
CheckBox
Controls and RadioButton
Controls are inherited from ToggleButton
classes, which means that users can toggle their switch states, where IsChecked
the property is a nullable Boolean type, which means that the property can be set to true, false or null.
A null value represents an indeterminate state, showing a shaded checkbox, an indeterminate state is used to represent a value that has not been set
<CheckBox Content="testA"/>
<CheckBox IsChecked="{x:Null}" Content="testA" IsThreeState="True"/>
In addition to the IsChecked property, the ToggleButton class adds IsThreeState
properties that determine whether the user can set the check box to an indeterminate state.
If the IsThreeState property is set to false (the default value), the stand-alone checkbox will toggle between checked and unchecked states.
If IsThreeState is set to true, the stand-alone check box will cycle through all three possible states.