Skip to main content

RepositoryItemCheckEdit.GetStateByValue(Object) Method

Converts the value passed as a parameter to the appropriate check state.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

public CheckState GetStateByValue(
    object val
)

Parameters

Name Type Description
val Object

A Object expression (typically, the edited value) to be converted to the appropriate check state.

Returns

Type Description
CheckState

A CheckState enumeration value representing the check state to be set.

Remarks

The GetStateByValue method is used to convert the CheckEdit.EditValue property value passed as the val parameter to an appropriate CheckState enumeration value for the CheckEdit.EditValue property.

Note that the GetStateByValue method generates the CheckEdit.QueryCheckStateByValue event, which enables you to implement custom conversion logic between a check state and the edited value. If the QueryCheckStatesEventArgs.Handled property remains set to false (the default behavior) in the event handler, predefined logic is used. In this case, the GetStateByValue method compares the edited value passed with the values of the RepositoryItemCheckEdit.ValueChecked, RepositoryItemCheckEdit.ValueUnchecked and RepositoryItemCheckEdit.ValueGrayed properties. If a match is found, the corresponding check state value is returned; otherwise, the method returns Unchecked.

Bear in mind that if a check editor functions in radio button mode (its RepositoryItemCheckEdit.RadioGroupIndex is set to a non-negative integer value), it cannot be set to the grayed state. The GetStateByValue method then returns Unchecked instead of Indeterminate.

Since the GetStateByValue method is intended for internal use, you may never need to call the method in your applications directly.

See Also