Menu

#23 Cannot unselect checkbox on ObjectListView

v2.X
open
nobody
None
3
2020-03-16
2020-03-16
No

I have installed a CheckStateGetter and CheckStatePutter in order to control a boolean field on my binded objects reflecting a checkstate on the first column.

        listViewShapeEvents.CheckStateGetter = delegate (Object row) {
            var evItem = (ShapeEventItem)row;
            if (evItem == null) return CheckState.Unchecked;
            return evItem.active ? CheckState.Checked : CheckState.Unchecked;
        };

        listViewShapeEvents.CheckStatePutter = delegate (Object row, CheckState newValue) {
            var evItem = (ShapeEventItem)row;
            if (evItem == null) return CheckState.Indeterminate;
            evItem.active = !evItem.active;
            return evItem.active ? CheckState.Checked : CheckState.Unchecked;
        };

I am not able to make it to work.

If the binded object already have the "active=true" flag, the box is checked but CANNOT be unchecked.
If the binded object do have "active=false", the box is unchecked AND user can check or uncheck (the CheckStatePutter is called).

There is something that prevent the CheckStatePutter to be called when the checkbox is set.

AspectName="active" on that column, if i do not specify AspectName, the whole checkbox system do not work, an indeterminate checkbox is displayed in all rows, despite the CheckStateGetter/Putter is specified.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.