My problem is the fellowing. I have a ListView which is bind to a list of object. Then i have a property in that object that is a boolean. In the ListView i have a checkbox which is set to checked or unchecked depending of the value of the bool of that particuliar object in the list.
So i told myself, why not when you click it perform some action on that row.. but the problem is that the action can be cancelled by the user such showing a windows with both apply and cancel. In the event of the user cancel the action.. the checkbox get checked anyway!
Is there a way to cancel this action ?
Thanks.
As long as you don’t have any special processing for when the checkbox is unchecked, then you can just move your special processing to occur when the checkbox is checked rather than firing on when it is clicked. If the cancel is chosen then you can uncheck the checkbox again by resetting the source bool in your object to False, and ignore the unchecked event.
If you do have special processing for unchecked, you can use the binding’s SourceUpdated event to detect when the checkbox caused the bool to flip to false rather than the bool causing the checkbox to flip to unchecked.
If you want to detect when your object’s bool caused a check to update:
If you want to detect when your checkbox caused your object’s bool to update:
You can do both at the same time, thus detecting changes both ways and acting accordingly, so that you can choose to act only when the data updated or only when the CheckBox updated.