RepositoryItemCheckEdit.AllowGrayed Property
Gets or sets whether the check editor supports three check states (‘Unchecked’, ‘Checked’ and ‘Indeterminate’) instead of two (‘Unchecked’ and ‘Checked’).
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true if the CheckEdit supports three check states; false if the editor only supports two check states. |
Remarks
Use the AllowGrayed property to determine whether a check editor supports two or three check states.
If this property is set to false, only two states - ‘Unchecked’ and ‘Checked’ are available. You can use the Checked property to get or set the value of a two-state editor.
If the AllowGrayed property is true, the editor can accept one of three check states: ‘Unchecked’, ‘Checked’ and ‘Indeterminate’. In the indeterminate (also called “grayed”) state, the editor’s check box is displayed with a dimmed appearance. You can get and set the value of a three-state editor with the CheckState property.
checkEdit1.Properties.AllowGrayed = true;
checkEdit1.CheckState = CheckState.Indeterminate;
checkEdit1.Properties.ValueGrayed = "Indeterminate";
checkEdit1.EditValue = "Indeterminate";
The check editor restores its indeterminate state after you switch the AllowGrayed property off and then on again.
To toggle the editor sequentially between the available check states, you can call the Toggle() method.
The editor that supports only two states (‘Checked’ and ‘Unchecked’) can still be in the ‘Indeterminate’ state. This happens if you set its EditValue property (for instance, via data binding) to any value except RepositoryItemCheckEdit.ValueChecked and RepositoryItemCheckEdit.ValueUnchecked. End-users, however, cannot activate the ‘Indeterminate’ state if the AllowGrayed option is false. Neither can the CheckState property be used to enable the ‘Indeterminate’ state.
When you assign a new value to the AllowGrayed property the PropertiesChanged event fires.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AllowGrayed 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.