locked
switching between brushes RRS feed

  • Question

  • We have a set of standard brush resources defined in our project, and I'm trying to help one of our designers switch between two brushes in two visual states.

    For simplicity, lets say I have two brushes defined as resources, NormalBrush and MouseOverBrush.  In Blend, I edit the template for a button and put in a rectangle with its Fill set to {StaticResource NormalBrush}.  In the States tab, I switch to the MouseOver state and change the Fill to {StaticResource MouseOverBrush}.

    What I would expect to happen is that Blend would create an ObjectAnimationUsingKeyFrames, with a single <DiscreteObjectKeyFrame Value="{StaticResource MouseOverBrush}"/>.  What actually happens is blend just changes the assignment globally, so that every state uses the MouseOverBrush.  The closest we have been able to come is to in-line the brush and have Blend generate multiple discrete "animate this color on this gradient stop to this color in the other brush" (which is obviously undesired as it destroys the relationship to the common resource).

    I did find this two-year-old post that mentions this not being supported yet.  Is there a way to accomplish this now in the current version of Blend?

    Thanks for your help!

    Thursday, August 26, 2010 4:25 PM