Why if I put this into a xaml dictionary used under Silverlight the compiler founds an error.
I assume the error you're getting is something like the following:
Failed to create a 'System.Byte' from the text '255'
The XAML parser in Silverlight only knows how to handle double
s, int
s and bool
s. The properties A
, R
, G
and B
in the Color
struct are all byte
s, which the Silverlight XAML parser doesn't know how to handle. The XAML parser in WPF, on the other hand, does know how to handle these values, so that's why you're not getting an error in WPF.
The MSDN documentation for the Color struct lists a number of ways to create a Color
value in XAML in Silverlight.
A similar question was asked a while ago about why float
s can't be used in XAML in Silverlight either.