Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Color element in XAML results in NullReferenceException
5 replies. Latest Post by arrgh on June 25, 2009.
(0)
arrgh
Member
21 points
14 Posts
06-21-2009 1:06 PM |
I've was working on a color picker control when I came across this problem. Here is the simplest example. The following causes an exception:
<Rectangle> <Rectangle.Fill> <SolidColorBrush> <SolidColorBrush.Color> <Color A="255" R="255" G="255" B="255" /> </SolidColorBrush.Color> </SolidColorBrush> </Rectangle.Fill> </Rectangle>
<Rectangle> <Rectangle.Fill> <SolidColorBrush Color="#FFFFFFFF"> </SolidColorBrush> </Rectangle.Fill> </Rectangle>
I'd hoped to use template binding for the red / green / blue values in my control, which is why the second markup would be unsuitable.
davidezo...
Contributor
5690 points
875 Posts
06-21-2009 2:53 PM |
Hi,
if you set the Color properties in code behind it works.
06-21-2009 3:25 PM |
Hi Davide,
Thanks for answering. I realize it works in code, and will work around this some other way. However it still is a bug that should be addressed as it prevents you from using it in a control template like I'm doing.
06-21-2009 3:42 PM |
Yes, I agree with you.
Mog Lian...
All-Star
15962 points
1,552 Posts
06-24-2009 11:27 PM |
Hi, arrgh
I use the latest silverlight build to run your code, it displayed as expected, this issue has been fixed.
thanks.
06-25-2009 11:32 AM |
Thanks Mog. It's nice to know this is resolved in SL3 (unfortunately I'm stuck with SL2 for now!).
Cheers.