Closed akasubi closed 8 years ago
@wezeku Would like to be an owner of this project? I have no capacity to maintain it going forward.
@dmitry-a-morozov I do like this project, so I'd be happy to be an owner of it. BTW, this pull req got closed because I'm moving it into a separate feature branch.
I've added binding of view level validators, i.e. ValidationRule descendants in WPF. I hope this is of interest!
Basic usage is:
Under the hood, the validation function gets wrapped in a ValidationRule object.
Thanks to FSharp.Quotations.Evaluator, you can supply extra arguments to the validation functions by currying:
Any existing ValidationRule descendants can be bound by ViewValidationRule:
<@ textBox.Text <- model.Value |> ViewValidationRule (ExceptionValidationRule()) @>
What's missing is maintaining a collection that keeps track of all view level validation rules, so that you can explicitly run them all with one call. That would useful for example when the user clicks "OK" and you want to validate the entire view. It's easy to implement, but I'm not sure where this would fit in best. One alternative is to have
PartialView.SetBindings
return a validator collection, which is stored in the view. This would requireBinding.OfExpression
to create and return that collection. Any thoughts about this?