using System; using System.Globalization; using Xamarin.Forms; namespace InABox.Mobile { public class FormatConverter : IValueConverter { public String Format { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var fmt = String.IsNullOrWhiteSpace(Format) ? "{0}" : $"{{0:{Format}}}"; return String.Format($"{fmt}", value); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }