Silverlight Get Color from Hex
Posted by: Laurent Duveau,
on 22 Apr 2009 |
View original | Bookmarked: 0 time(s)
What if you want to get a Color from its hexa value (#FFBBCC88) ? Unfortunately Silverlight do not have the ColorTranslator class which allows you to do ColorTranslator.FromHtml("#FF1133") in ASP.NET. What we have is the Color.FromArgb() method which takes 4 parameters (alpha, red, blue and green channels as bytes). So here is a small method you could write: public static SolidColorBrush GetColorFromHexa(string hexaColor)
{
return new SolidColorBrush(
Color.FromArgb(
...