Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1023805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:40:57+00:00 2026-05-16T11:40:57+00:00

I am trying to animate the Foreground color of a hyperlinkbutton when the user

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:40:58+00:00Added an answer on May 16, 2026 at 11:40 am

    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:

    <UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        mc:Ignorable="d"
        x:Class="SilverlightApplication1.GlowingHyperlinkButton"
        d:DesignWidth="94" d:DesignHeight="16">
        <UserControl.Resources>
            <Storyboard x:Name="MouseEnterStoryboard">
                <ColorAnimation Duration="0:0:0.5" To="#FFDF00EB" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="hyperlinkButton" d:IsOptimized="True"/>
            </Storyboard>
            <Storyboard x:Name="MouseLeaveStoryboard">
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="hyperlinkButton">
                    <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FF49ED28"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </UserControl.Resources>
    
        <Grid x:Name="LayoutRoot">
            <HyperlinkButton x:Name="hyperlinkButton" Content="HyperlinkButton" Foreground="#FF49ED28" d:LayoutOverrides="Width, Height">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="MouseEnter">
                        <ei:ControlStoryboardAction Storyboard="{StaticResource MouseEnterStoryboard}"/>
                    </i:EventTrigger>
                    <i:EventTrigger EventName="MouseLeave">
                        <ei:ControlStoryboardAction Storyboard="{StaticResource MouseLeaveStoryboard}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </HyperlinkButton>
        </Grid>
    </UserControl>
    

    Apologies for the horrid choice of colours. Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to animate the text color of a custom control between two colors,
I'm trying to animate a user control (in WPF) using it's visibility as a
I am trying to animate an object, let's say its a car. I want
I'm trying to animate an image which is partly hidden (via overflow: hidden) inside
I'm trying to animate a private variable named radius, which works. However while its
I'm trying to animate a simple ImageView in my application and I want it
I'm trying to animate a waterfall of divs like in duitang.com . i tried
I'm trying to animate a chess piece in a board. First I created a
I'm trying to animate part of UI in an iPad app when the user
I'm trying to animate a background image to move down a set amount of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.