Xamarin.Forms Plugin – Unobtrusive FluentValidation

Xamarin.Forms Plugin – Unobtrusive FluentValidation


One of my all time favorite libraries is FluentValidation, Jeremy Skinner has done a great job at producing a library that is easy to use and just works.  Whether it is trivial validation or complicated databases access validation, FluentValidation has the means to get it done; while keeping your validation away from your view.  I won’t go into depth on why one would need/want to separate validation from a view in this post, but I might make another post in future describing in detail why that is important.

This post will assume a basic understanding of MVVM and ASP.NET’s MVC Framework with a little common knowledge of javascript.

The Problem

During my expedition as a Xamarin developer, I’ve seen and tried many different forms of validation.  Some were great and some were just good, but they all seemed have different approaches on when or where the validation gets triggered.

From my experience the best user-interface one can offer when validation is a small and effective means of communication.  Not multiple popups with fancy emoticons of sad faces.  People already don’t like to click on their phones (just look at the most popular apps, they just scroll), so why force them to click an ‘X’ or an ‘okay’ button?  Just tell the user what they should do to correct the form and move on.

The Solution

So one night I decided to blend what FluentValidation.MVCX has to offer with Xamarin.Forms.

Enter the first Unobtrusive FluentValidation Plugin for Xamarin.Forms!

Now this plugin is built on top of the latest FluentValidation NuGet published version.  There isn’t anything that is specific with this version, just needed a starting place. If you need an older version, please let me know and I’ll do my best to support older versions.

Check out the code on GitHub and get the latest version from NuGet!


Take care and have a great day!

Xamarin MVC Project Separation & Fluent Validation – Part III

Continuing from Part II:

Finally, I’ll show you the actual validator implementation and that BaseType<T> you saw earlier.



public class UserProfileValidator : AbstractValidator&lt;UserProfile&gt;
	public UserProfileValidator()
		RuleFor(a =&gt; a.FirstName)
		.WithMessage("First Name required.");

		RuleFor(a =&gt; a.LastName)
		.WithMessage("Last name required.");

Continue reading “Xamarin MVC Project Separation & Fluent Validation – Part III”