Created
February 19, 2020 12:24
-
-
Save grimorde/b382c342ca61f4923569c05cea71e3aa to your computer and use it in GitHub Desktop.
First Validation Error Converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirstValidationErrorConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
ICollection<string> errors = value as ICollection<string>; | |
return errors != null && errors.Count > 0 ? errors.ElementAt(0) : null; | |
} | |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |
{ | |
throw new NotImplementedException(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment