The Input library provides the CheckBox control to select (check) or clear (uncheck) items. The CheckBox also lets the user report its value as indeterminate.
The check box works like a selection control which lets users select one or more options from a set.
The Input CheckBox control lets you change the appearance of the control by adding a color to the box using the Color property.
The following code snippet depicts setting color for the CheckBox using the Color property.
XAML |
コードのコピー
|
---|---|
<c1:C1CheckBox Content="Show button" Color="DarkSeaGreen" HorizontalAlignment="Left" Margin="346,240,0,0" VerticalAlignment="Top" /> |
A checkbox can be checked and unchecked, and these actions follow two events Checked event, which fires when a CheckBox is checked and Unchecked event, which occurs when a CheckBox is unchecked.
The following code snippet shows how to use both the events:
The Input CheckBox control provides a third state, the 'Indeterminate' state. For instance, you can use the indeterminate check box to denote a state when a user selects few, but not all items in the group. Also, for the indeterminate state to work in the CheckBox control, you need to set the IsThreeState property to true.
In the GIF below, you can observe the Select All checkbox indicating an indeterminate mode , when only one or two of the Option 1, Option 2 and Option 3 checkboxes are checked.
The code snippets depict how the "Select all items" checkbox behavior in different states: checked, unchecked and indeterminate using IsThreeState property and Indeterminate event.