Menu

#22 Fix for checkboxes not working when PersistentCheckBoxes is set to false

v2.8.x
accepted
nobody
None
1
2015-08-02
2015-06-17
Prommah
No

In 2.8.0 the part of the method FillInValues that handles checkboxes in ObjectListView.cs was changed, which broke checkboxes when PersistentCheckBoxes is set to false. Here is a fix:

Index: ObjectListView.cs
===================================================================
--- ObjectListView.cs   (revision 762)
+++ ObjectListView.cs   (working copy)
@@ -8253,7 +8253,8 @@
             // Set the check state of the row, if we are showing check boxes
             if (this.CheckBoxes) {
                 CheckState? state = this.GetCheckState(lvi.RowObject);
-                lvi.CheckState = state ?? CheckState.Unchecked;
+                if (state.HasValue)
+                    lvi.CheckState = state.Value;
             }

             // Give the RowFormatter a chance to mess with the item

Since GetCheckState will always return null when PersistentCheckBoxes is false, in 2.8.0 & 2.8.1 lvi.CheckState would be forced to CheckState.Unchecked, making checkboxes uncheckable. Restoring the previous code seems to resolve the issue.

Thanks

Discussion

  • Phillip Piper

    Phillip Piper - 2015-08-02

    Thanks for this. I have included it in v2.9

     
  • Phillip Piper

    Phillip Piper - 2015-08-02
    • status: open --> accepted
     

Log in to post a comment.