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

Controller.Active Property

Provides access to a collection of reason/value pairs used to activate or deactivate a Controller, or determine its active state.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll

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 Controller is made based on all the requests collected at the current moment. For example, the system may want to activate the Controller because the current View is appropriate. At the same time, the Security system may want to deactivate the Controller because the current User does not have the proper permissions. As a result, the Controller 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 Controller. This collection is used to determine whether the current Controller is active. If none of the collection items has the value part set to false, the Controller is active.

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

MyViewController myController;
//...
BoolList activeList = myController.Active;
if (activeList) {
    //...
}

To deactivate an active Controller, 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.

MyViewController myController;
//...
BoolList activeList = myController.Active;
activeList["myKey"] = false;

To activate an inactive Controller, 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 Controller 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.

MyViewController myController;
//...
BoolList activeList = myController.Active;
activeList["disablingKey"] = true;

To activate or deactivate an Action instead of the entire Controller, use the Action’s ActionBase.Active property.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Active 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