Skip to content

Instantly share code, notes, and snippets.

@grimorde
Created February 19, 2020 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grimorde/b382c342ca61f4923569c05cea71e3aa to your computer and use it in GitHub Desktop.
Save grimorde/b382c342ca61f4923569c05cea71e3aa to your computer and use it in GitHub Desktop.
First Validation Error Converter
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