I am trying to animate the Foreground color of a hyperlinkbutton when the user MouseOver the control. I created a custom style in which I want to animate the Foreground color. The Foreground color is set like so
<Setter Property="Foreground" Value="#FF73A9D8"/>
In the visualStateManager section I have the following element for the Color Animation
<ColorAnimation Duration="0:0:0.5"
Storyboard.TargetName="contentPresenter"
Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
To="Black" />
The problem is that I can not figure out what the value should be Storyboard.TargetName.
The text is set in a ContentPresenter control which does not have a Foreground property
You are correct. There is nowhere to hang the animation inside the control template.
While the HyperlinkButton has a foreground property, which is inherited by its content, the property is not exposed as part of the template.
Your best bet is to create a usercontrol that plays 2 storyboards via MouseEnter/MouseLeave behaviours ("GlowingHyperlinkButton" XAML below). You will of course still need to expose the content via a dependency property:
Apologies for the horrid choice of colours. Hope this helps :)