Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Color

 
 
Old 01-10-2006   #1 (permalink)
Bruno Silva


 
 

Color

Hi, I have an application with a color for some parts of the UI and I want
that the user is able to change that color so I tried to create a "style" of
that color and in code I have only to change that color and it would change
all the UI, so I did:


<GradientStop Color="{StaticResource bglight}" Offset="1"/>
....
<Window.Resources>
<SolidColorBrush x:Key="bglight" Color="#1A6CAA" />
</Window.Resources>

but the problem here is that it says that it can't find bglight, what am I
doing wrong here?

Thanks
Bruno Silva

My System SpecsSystem Spec
Old 01-10-2006   #2 (permalink)
Drew Marsh


 
 

Re: Color

Doug wrote:

> I have noticed in the November CTP that you have to define resources
> before you use them (literally before they are referenced in the XAML
> file).
>
> I'm sure this has changed from earlier versions, and as yet I haven't
> seen any mention as to why.


Yeah, this is a change specifically in the Nov. CTP actually. StaticResource
no longer supports forward looking resource resolution. They are resolved
according what resources are available in the current lexical scope while
parsing the XAML document.

HTH,
Drew


My System SpecsSystem Spec
Old 01-10-2006   #3 (permalink)
Nick Kramer [MSFT]


 
 

Re: Color

I touched on this in
http://blogs.msdn.com/nickkramer/arc...20/482915.aspx (second
paragraph). Long story short, we couldn't make for references work all the
time, so we decided not to support them.

Actually, in the November CTP, there's at least one case where we still
support forward references; at some point we'll stop supporting that as
well. The case we still support is one resource referring to another
resource in a resource dictionary (at least inside compiled xaml, not sure
about uncompiled), e.g.:
<Something.Resources>

<SomeObject x:Key="A" Property="{StaticResource B}/>

<SomeObject x:Key="B"/>

</Something.Resources>

That's a forward reference, we support that by accident today and will do
the correct, no forward references allowed behavior in a future CTP when we
correct StaticResource to behave lexically (see blog).

-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Doug" <doug@remove.11011.net> wrote in message
news:eca9ec38d1dc88c7cacfc3451080@news.microsoft.com...
>I have noticed in the November CTP that you have to define resources before
>you use them (literally before they are referenced in the XAML file).
>
> I'm sure this has changed from earlier versions, and as yet I haven't seen
> any mention as to why.
>
> There are some other problems with your XAML, but if you change it to:
>
> <Window.Resources>
> <SolidColorBrush x:Key="bglight" Color="#1A6CAA" />
> </Window.Resources>
> ...
> <GradientStop Color="{StaticResource bglight}" Offset="1"/>
>
> You should be able to make some progress.
>
> - Doug
>
>> Hi, I have an application with a color for some parts of the UI and I
>> want that the user is able to change that color so I tried to create a
>> "style" of that color and in code I have only to change that color and
>> it would change all the UI, so I did:
>>
>> <GradientStop Color="{StaticResource bglight}" Offset="1"/>
>> ...
>> <Window.Resources>
>> <SolidColorBrush x:Key="bglight" Color="#1A6CAA" />
>> </Window.Resources>
>> but the problem here is that it says that it can't find bglight, what
>> am I doing wrong here?
>>
>> Thanks
>> Bruno Silva

>
>
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
color value .NET General
Can't change Color of pages using color/appearance Vista installation & setup
off color Vista print fax & scan
Not all color names give right color? PowerShell
Color Changes Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46