Skip to main content
.NET 6.0+

ChoiceActionItem.Active Property

Provides access to a collection of reason/value pairs used to make a ChoiceActionItem active/inactive, or to determine its active state.

Namespace: DevExpress.ExpressApp.Actions

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

[Browsable(false)]
public BoolList Active { get; }

Property Value

Type Description
BoolList

A BoolList object that represents a collection of key/value elements.

Remarks

The decision to activate or deactivate a Choice Action Item is made based on all the requests collected at the current moment. For example, the system may want to activate the Choice Action Item because the object with which it is associated is available. At the same time, the Security system may want to deactivate the Choice Action Item because the current User does not have the proper permissions. As a result, the Choice Action Item cannot be activated, because there is at least one reason disallowing that. The Active property is designed to collect the reasons for activation/deactivation. It provides access to a collection of reason/value pairs. Each element of this collection is a pair consisting of a string value, representing a reason for activation or deactivation, and a Boolean value, that indicates whether to activate or deactivate the current Choice Action Item. This collection is used to determine whether the current Choice Action Item is active. If none of the collection items has the value part set to false, the Choice Action Item is active.

To determine whether a Choice Action Item is currently active, use the Active property in a conditional expression. Alternatively, use the BoolList.ResultValue property of the object returned by Active.

ChoiceActionItem myItem;
//...
BoolList activeList = myItem.Active;
if (activeList) {
    //...
}

To deactivate an active Choice Action Item, use the BoolList.SetItemValue method of the BoolList object returned by this property. Pass the reason for deactivation as the first parameter, and false, or a Boolean expression, as the second parameter. Alternatively, you can use the [key] operator of the BoolList object returned by the Active property, to get or set the specified key’s value.

ChoiceActionItem myItem;
//...
BoolList activeList = myItem.Active;
activeList["myKey"] = false;

To activate an inactive Choice Action Item, use the BoolList.RemoveItem method of the BoolList object, returned by this property. Pass the key (reason) of the item with the false value. If this is a single item that has the false value, the Choice Action Item will be activated. Alternatively, you can use the BoolList.SetItemValue method by passing the key, which has false as a value, and true as a new value for it.

ChoiceActionItem myItem;
//...
BoolList activeList = myItem.Active;
activeList["disablingKey"] = true;

When a Choice Action Item’s active state is changed, the ChoiceActionBase.ItemsChanged event is raised.

See Also