A list of string key/Boolean value pairs, which provides the resulting Boolean value, based on the pair values.
The BoolList class represents a wrapper over a dictionary of string key/Boolean value pairs. A string key names the associated Boolean value. Based on the Boolean values, the BoolList determines the resulting value and exposes it via the BoolList.ResultValue property. The resulting value is determined, either by logically multiplying or logically summing the values from the BoolList‘s collection of key/value pairs. You can specify how the resulting value is determined by specifying the BoolListOperatorType operatorType parameter when instantiating a BoolList via its BoolList constructor.
XAF uses BoolLists to provide conditional activation and deactivation of particular features. Consider the following example. Each Action has the ActionBase.Active property. This property exposes a BoolList, working in the BoolListOperatorType.And mode. When you specify an Action’s Target… properties, such as ActionBase.TargetObjectType, a corresponding key is created in the Action’s Active BoolList. Suppose that you have an Action whose ActionBase.TargetObjectType is set to Person. In this instance, the Action’s Active BoolList can look like this:
Key="Controller active" Value="True"
The first key’s value specifies that the Action’s Controller is active, and so the Action can also be active. The second key’s value specifies that the current View is not of the Person type, so the Action cannot be active. The resulting value of the Active BoolList is determined by logically multiplying the values from the BoolList, which in this example yields false. So, the sample Action will not be activated.
The BoolList class overrides the BoolList.Equals method. This allows you to use instances of the BoolList class in Boolean expressions, and compare such instances directly to Boolean values. The following code snippet illustrates this.
To add a new key/value pair to a BoolList or modify an existing one, use the BoolList.Item indexer property. Alternatively, you can use the BoolList.SetItemValue method. To remove an item from a BoolList, use the BoolList.RemoveItem method.