StringWithDefaultValueConverter.cs 588 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Globalization;
  3. using Xamarin.Forms;
  4. namespace InABox.Mobile
  5. {
  6. public class StringWithDefaultValueConverter : IValueConverter
  7. {
  8. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  9. {
  10. return String.IsNullOrWhiteSpace(value as String)
  11. ? parameter
  12. : value;
  13. }
  14. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  15. {
  16. throw new NotImplementedException();
  17. }
  18. }
  19. }