I have been playing with the Blend August Preview and in particular the resource feature. This is an excellent feature that allows you to style your user interface from a single location much like CSS does for web pages.
I created a new project. I added a rectangle to the window and changed its color to a nice shade of blue:
I created another rectangle next to the original rectangle and removed the stroke from both of them:
Clicking on the original rectangle, I converted the color to a resource named MyColor and put it in a new resource dictionary:
Now, when I change MyColor in the resource dictionary, all instances of MyColor will change with it:
So far, so good. I would now like my second rectangle to be a linear gradient going from MyColor to black. When I change MyColor I want it to change the initial gradient color too.
Unfortunately, there doesn't seem to be a way to do this in the GUI. Fortunately, there is a very simple way to do this in the XAML.
Click on the second rectangle and change its fill to a gradient. Change the first gradient color to red and the second gradient color to black:
Now, convert the gradient brush to a resource. Call it MyBrush and put it in the same resource dictionary.
Save all of your files and click on the resource dictionary file. Open it in XAML view. You should see the following:
Change the first gradient stop from "#FFFF0000" (red) to "{DynamicResource MyColor}":
Now, when you change MyColor, the first color in the MyBrush resource will also change:
