#852 – Setting a Three-State CheckBox to an Indeterminate Value
June 28, 2013 1 Comment
A three-state CheckBox can take on one of three values: true, false, or indeterminate. You can use data binding to get/set the value of a three-state CheckBox, binding the control to a nullable bool.
You can also explicitly set the value of a CheckBox, in either XAML or code.
To set a CheckBox to an indeterminate value in code, just set its IsChecked property to null.
chkPie.IsChecked = null;
To set a CheckBox to an indeterminate value in XAML, set its IsChecked property to {x:Null}.
<CheckBox Name="chkPie" Content="I Like Pie" IsThreeState="True" IsChecked="{x:Null}"/>