james-russo / xamarinforms-unobtrusivevalidationplugin Goto Github PK
View Code? Open in Web Editor NEWA plugin library that extends the functionality of FluentValidation for Xamarin.
License: MIT License
A plugin library that extends the functionality of FluentValidation for Xamarin.
License: MIT License
Seems to be in both Xaml and code behind.
I cant put place holder with ValidatableEntryControl
There are projects which were done in Xamarin and the current nuget package supported well. As Microsoft recommends to migrate to Maui the current nuget package doesn't support it.
Any suggestion and thoughts about it?
Hey,
I am trying to extend the functionality to include a validatablePickerControl. I have this largely working except i cannot pass through the ItemDisplayBinding from the xaml. Below is some code snippets. Any pointers greatly appreciated.
public static BindableProperty ItemDisplayBindingProperty = BindableProperty.Create(
nameof(ItemDisplayBinding),
typeof(BindingBase),
typeof(ValidatablePicker));
public BindingBase ItemDisplayBinding
{
get => _picker.ItemDisplayBinding;
set => _picker.ItemDisplayBinding = value;
}
/// <summary>
/// </summary>
public ValidatablePicker()
{
_picker.BindingContext = this;
_picker.SetBinding(Picker.ItemsSourceProperty, nameof(ItemsSource));
_picker.SetBinding(Picker.TitleProperty, nameof(Title));
_picker.SetBinding(Picker.SelectedIndexProperty, nameof(SelectedIndex));
_picker.ItemDisplayBinding = ItemDisplayBinding;
Children.Add(_picker);
_errorLabel.SetBinding(IsVisibleProperty, nameof(IsInValid));
_errorLabel.SetBinding(Label.TextProperty, nameof(Message));
_errorLabel.BindingContext = this;
_errorLabel.TextColor = Color.Red;
Children.Add(_errorLabel);
}
<controls:ValidatablePicker
SelectedIndex="{Binding Model.TypeSelectedIndex, Mode=TwoWay}"
ItemsSource="{Binding AssetTypes}"
ItemDisplayBinding="{Binding Description}"
BindingName="AssetTypeId"
Title="Select asset type"
/>
When i use the source code instead of install the library from nuget, i find that The plugin is not compatible with the latest release of FluentValidation Plugin,
The maximum version of fluentvalidation allowed is 7.1.1
I've been using your plugin for a while as the best way to do validation in my Xamarin project.
However, with the recent update to FluentValidation 9.0.1 the plugin does not work any more. The FluentValidation.ValidatorAttribute
package is not supported on 9.+ and that gives a challenge in the AbstractValidationViewModel
method:
public ValidationResult GetValidationResult()
{
var attributeFactory = new AttributedValidatorFactory();
var type = GetType();
var validator = attributeFactory.GetValidator(type);
var results = validator.Validate(this);
return results;
}
as the AttributedValidatorFactory
doesn’t exist any more. I'm not sure how to work around this?
The migration documentation in FluentValidation suggests using an IoC container instead - but that seems quite another approach to what this plugin does - so I'm not sure how to do this (still a little new on DI though I'm building on Prism using DryIoc).
Hoping to get some suggestions to go with.
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.