I'm looking for a way to convert a Xamarin.Forms.Color to a platform specific color. For example the Android.Graphics.Color for Android.
I took a look at the properties of the Xamarin.Forms.Color like R, G & B. The values only contain a 0 or 1 so that seems to be pretty worthless. Has someone experienced and solved this issue before?
I guess you try to do this in a custom renderer.
In iOS, you'd do:
UIColor uicolor = yourXFColor.ToUIColor ();
Android.Graphics.Color adColor = yourXFColor.ToAndroidColor ();
Unfortunately, the equivalent extension methods are not public for WP, but you can do this:
System.Windows.Media.Color wpColor = System.Windows.Media.Color.FromArgb ( (byte)(yourXFColor.A * 255), (byte)(yourXFColor.R * 255), (byte)(yourXFColor.G * 255), (byte)(yourXFColor.B * 255));
Brush brush = new SolidColorBrush (wpColor);