Skip to main content
A newer version of this page is available. .

CheckEdit.CheckState Property

Gets or sets the editor’s check state.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(CheckState.Unchecked)]
[DXCategory("Appearance")]
public virtual CheckState CheckState { get; set; }

Property Value

Type Default Description
CheckState **Unchecked**

The check editor’s state.

Remarks

CheckEdit_AllowGrayed_ThreeStates.gif

A check editor can have two states (checked or unchecked), or three states (checked, unchecked, or indeterminate - also called the grayed state). The RepositoryItemCheckEdit.AllowGrayed property specifies if users may set a Check Editor to the indeterminate state. If you disable the RepositoryItemCheckEdit.AllowGrayed property for an editor in the indeterminate state, it continues to show as indeterminate (although the CheckState property will return the Unchecked value).

The following three properties allow you to set or determine the editor’s state:

CheckState

Checked

EditValue

Checked

true

true (or ValueChecked)

Unchecked

false

false (or ValueUnchecked)

Indeterminate

Returns true

null, Nothing (or ValueGrayed)

The code sample below changes the state order to indeterminate, checked, unchecked when users click on a three-state check edit.

ChangedCheckStates

checkEdit1.Properties.AllowGrayed = true;
checkEdit1.ReadOnly = true;
checkEdit1.MouseDown += CheckEdit1_MouseDown;

private void CheckEdit1_MouseDown(object sender, MouseEventArgs e)
{
    CheckEdit edit = sender as CheckEdit;
    switch (edit.CheckState)
    {
        case CheckState.Checked:
            edit.CheckState = CheckState.Unchecked;
            break;
        case CheckState.Indeterminate:
            edit.CheckState = CheckState.Checked;
            break;
        case CheckState.Unchecked:
            edit.CheckState = CheckState.Indeterminate;
            break;
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CheckState property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also