Hi Hugo,
There are several problems with that code:
1 - The Checkbox is bound to the wrong property
2 - The BindingMode is not set to TwoWay
3 - The backing field is incorrect and there's no equality check
Let's take care of the most important ones first.
The biggest problem is that the Checkbox should be bound to
IsEscaneado (not Escaneado).
In XAML, you need to set the binding mode to TwoWay if you want the UI element to also update the bound property. You can learn more in the Microsoft tutorial documentation:
Data Binding Basics - The Binding Mode.
Here's what the code will look like after fixing #1 and #2
Regarding #3, I have two more suggestions:
- I would also
add an equality check in the setter, this will prevent a lot of unnecessary property changed events form firing
- Use a
property named backing field
That way you'll never accidentally use the wrong property because it starts with a lower-case letter. Private backing fields are just for the public property to use to hold the value and should never be used for binding.
Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items