Why binding to label's enabled property crashes the app

176 views Asked by At

I am trying to bind a view model variable with label's enabled property but it crashes the app

bindings.Add(this.SetBinding(() => this.Vm.IsEnabled, () => this.lblDate.Enabled, BindingMode.TwoWay));

The crash is always reproducible in release mode.

enter image description here

Here is the crash report

1

There are 1 answers

0
Madalin Sisu On

It looks like the Enabled property of lblDate doesn't have a public setter, but being a control I am almost sure it has. I found on this page that one solution would be to add the [Preserve] attribute to your property in view-model