Closed maurosampietro closed 8 years ago
Hi, again, it is behavior not of "CalcBinding" but of "standart Binding". If you switch to usual Binding you will receive exactly same exception.
I saw wpf sources in place where ReadOnly property check is doing. So the answer is: no, you cannot do with this anything. Check on readonly property is doing in a deap WPF callstask, where there is all informataion about concrete property. When I create new Binding expression, I havent such important info about what source and properties I binding, that information doesn't exist. So I cannot found out what property I have to bind to and its type
I have the same problem. It seems that even when the standard binding happily accept the read only property, CalcBinding is still not accepting it unless have "Mode=OneWay" set.
Especially, when binding Visibility, WPF standard binding will accept a read only property happily, but with CalcBinding we have to add "Mode=OneWay" if it is read only.
If I switch to usual Binding i'm not forced to explicitly set "Mode=OneWay" and i don't get any exception.
Hi guys, it's very strange, because after first comment I wrote an example to check that is is behavior of standart binding. Ok, I repeat my check. By the way, what version of .net framework you use? May be that behavior depends on it.
Thank you guys, it's really bug, CalcBinding sets Mode = BindingMode.TwoWay by default but standart binding sets Mode = BindingMode.Default by default. In my previously proove example I used TextBox.Text property which has Mode = BindingMode.TwoWay by default, thus I couldn't reproduce your issue. After switch to Label.Content which has BindingMode.OneWay I reproduced problem.
version 2.2.5.2 is released
I get an exception every time i forget to set Mode=OneWay for getter-only properties. is it possible to autodetect such properties and automatically set binding Mode=OneWay?