![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 |
| | #2 (permalink) |
| 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 |
| | #3 (permalink) |
| 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 |
| | #4 (permalink) |
| Guest | RE: Color I agree, but that still doesn't solve my problem it still says it can'tfind 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 |
| | #5 (permalink) |
| 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 > > > > |
| | #6 (permalink) |
| 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 |
| | #7 (permalink) |
| 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 > > > > |
| | #8 (permalink) |
| 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 > > > |
| |
| |
![]() |
| 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 |