While working with SilverLight using Visual Studio 10, I found that in design mode XAML allows a wide plethora of colors. For ex. Lime is a valid color in XAML.
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Lime" Offset="1" />
While working with code though, I found that Lime and many other colors are missing…
GradientStop blueGS = new GradientStop(); blueGS.Color = Colors.Lime;
What am I missing? Both of these colors belong to System.Windows.Media.Colors.
From the MSDN page for
System.Windows.Media.Colors(Silverlight version):So, for whatever reason, it looks like you’re effectively right; you can refer to more “named” colors in XAML than you can in the codebehind.
Also, you can always use the
Color.FromArgbmethod in your code: