summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 20:02:25 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-03-22 23:13:41 (GMT)
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
Initial import
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs')
-rw-r--r--Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs b/Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs
new file mode 100644
index 0000000..7f8aeef
--- /dev/null
+++ b/Xamarin.Forms.Platform.WP8/TextAlignmentToHorizontalAlignmentConverter.cs
@@ -0,0 +1,43 @@
+´╗┐using System;
+using System.Globalization;
+using System.Windows;
+
+namespace Xamarin.Forms.Platform.WinPhone
+{
+ public sealed class TextAlignmentToHorizontalAlignmentConverter : System.Windows.Data.IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var alignment = (System.Windows.TextAlignment)value;
+
+ switch (alignment)
+ {
+ case System.Windows.TextAlignment.Center:
+ return HorizontalAlignment.Center;
+ case System.Windows.TextAlignment.Left:
+ return HorizontalAlignment.Left;
+ case System.Windows.TextAlignment.Right:
+ return HorizontalAlignment.Right;
+ default:
+ return HorizontalAlignment.Left;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var alignment = (HorizontalAlignment)value;
+
+ switch (alignment)
+ {
+ case HorizontalAlignment.Left:
+ return System.Windows.TextAlignment.Left;
+ case HorizontalAlignment.Center:
+ return System.Windows.TextAlignment.Center;
+ case HorizontalAlignment.Right:
+ return System.Windows.TextAlignment.Right;
+ default:
+ return System.Windows.TextAlignment.Left;
+ }
+ }
+ }
+} \ No newline at end of file