Blend color resource syntax causes error in VS
Last post 05-03-2008 6:09 PM by R. Wiltschek. 2 replies.
Sort Posts:
05-03-2008 12:20 PM
No [N]Blend color resource syntax causes error in VS
If you create a Color resource in Blend, Visual Studio will not compile it:
"The type 'Color' does not support direct content."


Example:
<Color x:Key="test">#FFAABBCC</Color>

The only workaround I know is to write it like this:
<Color x:Key="test" A="255" R="170" G="187" B="204"/>
But then if you decide to change the color in Blend, it will convert it back to the faulty syntax.

Oh, and.. static referencing Color resources within the resources section (which works fine in Blend) prevents the application from running / causes an unknown runtime error in Visual Studio.
R. Wiltschek

Joined on 04-02-2008
Posts 14
05-03-2008 5:54 PM
Re: Blend color resource syntax causes error in VS

This works for me (though I get a syntax coloring warning but it still compiles).

(If this has answered your question, please "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 2 Workshop
May 12-14, 2008 - Atlanta, GA
May 28-30, 2008 - San Francisco, CA
http://www.silverlight-tour.com

swildermuth

Joined on 10-13-2003
Atlanta, GA
Posts 1,058
05-03-2008 6:09 PM
Re: Blend color resource syntax causes error in VS
Did you manage to reference colors? E.g. Have a gradient resource that references two color resources?
R. Wiltschek

Joined on 04-02-2008
Posts 14