summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/Converters/CaseConverter.cs
blob: b972fc57ad79df0284f7e6bea30b58868bb3e53c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
		}
	}
}