Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Color

Closed Thread
 
Thread Tools Display Modes
Old 01-10-2006   #1 (permalink)
Bruno Silva
Guest


 

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
Old 01-10-2006   #2 (permalink)
viliescu
Guest


 

RE: Color

You cannot use a brush as a color.
So instead of
<SolidColorBrush x:Key="bglight" Color="#1A6CAA" />
use
<Color x:Key="bglight">#1A6CAA</Color>

Regards,
Valentin

"Bruno Silva" wrote:

> 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

Old 01-10-2006   #3 (permalink)
Doug
Guest


 

Re: Color

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




Old 01-10-2006   #4 (permalink)
Bruno Silva
Guest


 

RE: Color

I agree, but that still doesn't solve my problem it still says it can't
find the resouce named bglight

Thanks

"viliescu" wrote:

> You cannot use a brush as a color.
> So instead of
> <SolidColorBrush x:Key="bglight" Color="#1A6CAA" />
> use
> <Color x:Key="bglight">#1A6CAA</Color>
>
> Regards,
> Valentin
>
> "Bruno Silva" wrote:
>
> > 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

Old 01-10-2006   #5 (permalink)
Bruno Silva
Guest


 

Re: Color

Yes! you're right, it's like good old Pascal where I had to make all
functions and procedures before de main code
Thanks Doug!

Bruno Silva

"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.
>
> 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

>
>
>
>

Old 01-10-2006   #6 (permalink)
Drew Marsh
Guest


 

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


Old 01-10-2006   #7 (permalink)
Bruno Silva
Guest


 

Re: Color

Hi again, just one more question if you don't mind, I got all the colors in
the window resouces, now how do I access them to change their value? I've
thought that I could just call them by their x:Key

Thanks
Bruno Silva

"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.
>
> 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

>
>
>
>

Old 01-10-2006   #8 (permalink)
Nick Kramer [MSFT]
Guest


 

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

>
>
>



Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't change Color of pages using color/appearance Nate Vista installation & setup 1 12-24-2007 12:27 AM
off color tstp Vista print fax & scan 3 08-22-2007 05:42 PM
Dir with Color Cedric Tallichet PowerShell 19 07-12-2007 03:48 PM
Not all color names give right color? Lucvdv PowerShell 3 11-08-2006 05:59 AM
Color Changes David Hankinson Vista General 6 10-10-2006 04:53 PM








Vistax64.com 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 2005-2008

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 47 48 49 50