diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs')
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs b/Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs new file mode 100644 index 00000000..b972fc57 --- /dev/null +++ b/Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; + +namespace Xamarin.Forms.Platform.WinPhone +{ + public class CaseConverter : System.Windows.Data.IValueConverter + { + public bool ConvertToUpper { get; set; } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + return null; + + var v = (string)value; + return ConvertToUpper ? v.ToUpper() : v.ToLower(); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } + } +}
\ No newline at end of file |