using System; using System.ComponentModel; using System.Globalization; using Xamarin.Forms; namespace InABox.Mobile { public class StringToBooleanConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return !String.IsNullOrWhiteSpace(value as String); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class StringWithDefaultValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return String.IsNullOrWhiteSpace(value as String) ? parameter : value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }