Search This Blog

Thursday, September 1, 2016

Minor usability improvement - Nullable values support for boolean property editors

In short, this feature was already supported by the underlying WinForms CheckEdit and ASP.NET ASPxCheckBox controls, but it required writing some custom code in XAF apps. Now this coding is no longer required for XAF users if they need a Nullable<bool> property.

Starting with v16.1.6, the two built-in XAF editors support boolean Nullable properties. In the UI, when the check box is used, nullable properties will be displayed using a third 'grayed' state. When a drop-down editor is used, an empty 'null text' item will be available. Technically, the PropertyEditor.AllowNull must return True for the aforementioned UI transformations to take effect.

Please see the following code examples and screenshots for more details:

        public bool? ThreeStateCheckBox {
        [CaptionsForBoolValues("Checked", "Unchecked")]
        public bool? ThreeStateDropDown {



Note that we have not polluted the Application Model with the new CaptionForEmpty/ImageForEmpty options to customize an caption and image for an empty item in 'drop down' mode respectively. In WinForms, it is just an empty string while in ASP.NET it is a familiar 'N/A', which is derived from the PropertyEditor.NullText or the Localization | Texts | NullValueText node in the Application Model. If you want to have this as well, please provide us with screenshots showing specific use-case scenarios where it can be helpful for your business. With that, we will be in a better position to evaluate any future improvements in this regard.

As always, my team and I are looking forward to hearing from you. Thanks in advance!


  1. Hi Dennis,

    I would benefit from the NullValueText.
    e.g. Quality Check: (Ok / NOK / TBD), N/A could result in Quality check not being performed as it would be considered as Not Applicable.

    1. Hi Michael,
      This post is about nullable booleans, but you already have 4 or more than 3 possible values (true,false,null) here...It seems that you need an enumeration or reference type property for this task. If so, it is already possible to supply a null value text for them.

  2. Dennis & Team, thanks! Needed it a view months ago and was a little dissapointed that such a 'default'-behaviour needed some custom code. Now, the world looks nicer again. Will change my code immediately.

  3. @Sascha: We are happy to hear that this improvement was helpful!