Fix for checkboxes not working when PersistentCheckBoxes is set to false
ObjectListView - ListView on caffeine, guarana and steroids
Brought to you by:
grammarian
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
Thanks for this. I have included it in v2.9