fsprojects-archive / zzarchive-FSharp.Desktop.UI

F# MVC framework for WPF.
http://fsprojects.github.io/FSharp.Desktop.UI/
Other
81 stars 21 forks source link

Calculator Sample - unexpected red highlight on error #2

Closed halfAbee closed 9 years ago

halfAbee commented 10 years ago

When I run the calculator sample and give the value "-1" to "Y", and then click on the "+" button, the box containing -1 is highlighted with a red border, which makes sense (since we don't allow addition with values of "Y" less than 0).

I don't understand why the "/" button is also highlighted.

When I comment out the "divide.IsEnabled <- model.Y <> 0." binding, the red border does not appear on the "/" button using the above sequence of events.

My guess is that an error in the "Y" box causes some confusion with the divide by zero constraint.

Is there a problem here, or have I missed something?

I'm enjoying the great work being done in F# Deep Dives.

Regards,

g.

dmitry-a-morozov commented 9 years ago

I realized that I had notifications misconfigured for this project. That's why I'm so late to respond. Sorry. The issue has been fixed in ver 0.2.0-beta. Thank you reporting it and being the library user ! It's very encouraging. I'm glad you liked "F# Deep Dives" chapter.

halfAbee commented 9 years ago

Thanks! It does indeed work as expected now.

I was trying to understand the diff - you uncomment binding.ValidatesOnNotifyDataErrors <- false and you remove some other similar commented statements.

Does this mean that there are scenarios where assigning true would be better?

g.

dmitry-a-morozov commented 9 years ago

"true" is default value for ValidatesOnNotifyDataErrors. I was puzzled in this issue a little bit too. Validation makes sense only for properties that take input from user. It must be either twoWay or OneWayToSource data-binding mode. There is no point to have validation notifications for derived bindings (via converter or expression) because input errors never caused by state transferred via these bindings.