Elmish.WPF icon indicating copy to clipboard operation
Elmish.WPF copied to clipboard

Return errors as ObservableCollection<object>

Open xperiandri opened this issue 3 years ago • 9 comments

When doing validation with https://github.com/lfr/FSharp.Domain.Validation or https://github.com/JamesRandall/AccidentalFish.FSharp.Validation you can have mo than one error per property. UWP does not have native support of INotifayDataErrorInfo so that we created our control that displays errors via ItemsControl which prefers ObservableCollection as ItemsSource

I think that validation errors must be returned similar to Binding.oneWaySeq where you can set comparers and merge new errors seq into old errors and update UI (ItemsControl) accordingly.

xperiandri avatar Mar 06 '21 20:03 xperiandri

I will show the proposed changes the next week

xperiandri avatar Mar 06 '21 20:03 xperiandri

That makes sense. I am open other ways to handle validation errors.

I am interested to see the proposed change.

TysonMN avatar Mar 06 '21 21:03 TysonMN

The user is free to expose "errors" (just like any other data) via a OneWaySeq or SubModelSeq binding. I have not thought very hard about the tradeoffs between the current/INotifayDataErrorInfo approach and this alternative approach.

TysonMN avatar Mar 08 '21 02:03 TysonMN

#379

xperiandri avatar Apr 03 '21 23:04 xperiandri

In the suggested / proposed change is, would Elmish.WPF continue to use INotifyDataErrorInfo or stop using it?

TysonMN avatar Jun 30 '21 12:06 TysonMN

Continue

xperiandri avatar Jun 30 '21 12:06 xperiandri

@xperiandri, the animation I saw in UWP with addition/removal from an ObservableCollection<> looked great. I assume that this requires the more complicated keyed merge (aka a merge that uses IDs).

What would the animation look like if the unkeyed (aka merge that doesn't use IDs) were used? Can you record that animation would look like and share it here in a comment as an animated GIF?

TysonMN avatar Sep 08 '21 00:09 TysonMN

Do you want me to record it with your merge algorithm?

xperiandri avatar Sep 08 '21 08:09 xperiandri

Yes, that would be preferred. Maybe you could record the animation for both algorithms so that the difference is clear to us.

TysonMN avatar Sep 08 '21 10:09 TysonMN