ChaseFlorell / Feedback

Contact me here.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FluentValidation for Xamarin Forms revisited...

IndianaGary opened this issue · comments

Hi Chase,

I started with your code and made several changes to support the latest version of FluentValidation (10.0). I also perceived a weakness in that, if data is never entered, SetPropeerty is never called so validation will never occur. I solved that by implementing an Unfocused event handler to force validation when the user navigated away from the field. I call my version EntryEx (it's shorter). I plan to send my version to the Xamarin Community Toolkit, however, I wanted to ask permission first, since I started with code you developed. I attached my code so that you can update yours if you so wish. BTW, I also moved to C#9.0 so there may be a few backward compatibility issues to consider.

Controls.zip

Hey Gary, thanks for passing this along.
I've modified this code a lot over the years and have now componentized all the effort.

The way I approach the validation of the entire graph (if data is never entered) is to have a Button wrapped in a ContentView wired up to a "ValidateAllCommand" on the TapGestureRecognizer. I also set the canExecute of the command to the IsValid of the validator, that way the command will actually be disabled until a full object validation has occurred. That full validation is forced behind the validate all command.

Hey Gary, forgive my ignorance, what is XCT?

Pardon the delay: XCT is the Xamarin Community Toolkit... It's community driven but managed by Microsoft employees... A version of it is being established for Maui. Have you started looking at Maui yet?