xamarin set view background color from a hex value
I believe you're looking for the ParseColor method that takes in a string and returns the integer color.
view.BackgroundColor = Android.Graphics.Color.ParseColor("#FF6A00");
Supported formats are:
- #RRGGBB
- #AARRGGBB
- 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray'
From their example.. I think you just need to drop the #.
view.BackgroundColor = Color.FromHex("FF6A00")
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/colors/
Depending on your target, you may want to try the parseColor method on the color class instead.
How to get a Color from hexadecimal Color String
public static int parseColor (String colorString)
It claims to take hex values :
... formats are: #RRGGBB #AARRGGBB 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray'