A newer version of this page is available. Switch to the current version.

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.v19.2.dll

Declaration

[DXCategory("Behavior")]
[DefaultValue(false)]
public bool AllowGrayed { get; set; }

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.

checkEdit1.Properties.AllowGrayed = false;
checkEdit1.Checked = true;

CheckEdit_AllowGrayed_TwoStates.gif

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";

CheckEdit_AllowGrayed_ThreeStates.gif

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.

See Also