mardi 28 juin 2022

WPF: set false as default for all checkbox controll

I have many checkbox binding nullable bool values and when I press on the control, if it's set to false, I have to press twice to get true. Is it possible to have true as the first value or false as default when I have null for all the checkbox, for example with a style?

I've tried with this before, and it works:

<CheckBox  IsThreeState="False" IsChecked="{Binding MY_NULLABLE_PROPERTY, TargetNullValue=false}"/>

but I would like a generic solution for each control




Aucun commentaire:

Enregistrer un commentaire