Techie Post: Using .Net Colors class with Silverlight

Every once in a while, the skies seem dreary & life is miserable. That is when I turn to my ultimate euphoria...programming.

I am playing around with Silverlight / C# to access some XML over the web & wanted to bind it to a few UI controls. One of the strings in the XMLDocument is color & I thought this would be really easy, I should just be able to do this:

lblStatus.Background = new SolidColorBrush(Colors.Blue);

But, Silverlight does not like this. In the non-Silverlight .Net world, this would be just fine. I really did not want to write my own little conversion between String values of Colors to RGB; And that is when I stumbled upon this little gem (Thank you Pencho Popadiyn & Google). Pencho has written a class that serves as a converter (using user defined implicit conversion in .Net - who knew these things existed)...

Anyways, it works like a charm...More details & the source code here...