summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs b/Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs
new file mode 100644
index 00000000..961c0422
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/ConvertExtensions.cs
@@ -0,0 +1,23 @@
+´╗┐using Windows.UI.Xaml.Media;
+
+#if WINDOWS_UWP
+
+namespace Xamarin.Forms.Platform.UWP
+#else
+
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ internal static class ConvertExtensions
+ {
+ public static Brush ToBrush(this Color color)
+ {
+ return new SolidColorBrush(color.ToWindowsColor());
+ }
+
+ public static Windows.UI.Color ToWindowsColor(this Color color)
+ {
+ return Windows.UI.Color.FromArgb((byte)(color.A * 255), (byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255));
+ }
+ }
+} \ No newline at end of file