![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Reusing a color Hello. ![]() I have a custom control that has a Color property. In this control's style I want to use this color with different Alpha values. And I want to do this using just XAML. I've tried some tricks like setting a <Color> element in the Resources section binding it to the control's Color. Then, I tried to get each of the R, G and B values into a new <Color> element in the Resources. In this <Color> element I would change the Alpha value and get the color I wanted, but it doesn't seem to work... Anyway, it seems to complicated to my likings... Any ideas? Thanks. -- Duque Vieira |
| | #2 (permalink) |
| Guest | Re: Reusing a color Color is a struct, not a DependencyObject, so its individual properties are not DependencyProperties. As such, you cannot set their values to dynamic resource references, databindings, etc. You can write a data converter which will multi-bind to a color and an opacity and combine them to form a new color - while this will be code, all of the usage will be in markup. Alternately, many places where you can use a Color in WPF also allows you to set the Opacity independently, such as SolidColorBrush.Color and SolidColorBrush.Opacity. This is not universally available (e.g. GradientStop doesn't have an Opacity property), but it's something to consider depending on your scenario. -Adam Smith [MS] "Duque Vieira" <duquevieira@modellus.com> wrote in message news:12E5B1A9-0A0F-4CEF-A765-49C5CE385A54@microsoft.com... > Hello. ![]() > > I have a custom control that has a Color property. > In this control's style I want to use this color with different Alpha > values. > And I want to do this using just XAML. > > I've tried some tricks like setting a <Color> element in the Resources > section binding it to the control's Color. > Then, I tried to get each of the R, G and B values into a new <Color> > element in the Resources. > In this <Color> element I would change the Alpha value and get the color I > wanted, but it doesn't seem to work... > > Anyway, it seems to complicated to my likings... > > Any ideas? Thanks. > > -- > Duque Vieira |
| |
| |
![]() |
| 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 |
| reusing cd-key? | Liam Richmond | Vista installation & setup | 1 | 09-19-2007 05:25 AM |
| Reusing The Activation Key | Robert | Vista General | 6 | 02-23-2007 12:54 PM |
| Not all color names give right color? | Lucvdv | PowerShell | 3 | 11-08-2006 05:59 AM |
| FindResource problem( Reusing Drawings ) | Adam Smith [MS] | Avalon | 3 | 09-07-2006 11:41 AM |