Boolean operators
An expression can be prefixed with a boolean operator, which causes the expression to evaluate to a boolean value.
| Operator | Description |
|---|---|
! | inverts the boolean value; converts 0 or null to true |
!! | inverts the boolean value twice; converts 0 or null to false |
In the following example, the controls are disabled or hidden when the bound list is empty:
<!-- disabled=true when size=0 -->
<MyAddressControl disabled="${!user::addresses.size}"/>
<!-- visible=false when size=0 -->
<MyAddressControl visible="${!!user::addresses.size}"/>
Applicability
A boolean operator is applicable to any expression type, not just boolean expressions. However, restrictions apply depending on which expression type is used.
| Markup extension | Applicable |
|---|---|
fx:Evaluate | all non-content expressions |
fx:Observe | all non-content expressions |
fx:Synchronize | only if the binding source implements WritableValue<Boolean> |