Skip to content

Instantly share code, notes, and snippets.

@Char0394
Created June 2, 2020 13:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Char0394/9e3426f60cc343b5738627f40cd55059 to your computer and use it in GitHub Desktop.
Save Char0394/9e3426f60cc343b5738627f40cd55059 to your computer and use it in GitHub Desktop.
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)
{
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment