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 1076771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:28:49+00:00 2026-05-16T21:28:49+00:00

I created a ColorAnimation for a SpotLight-object, but it doesn’t seem to work. What

  • 0

I created a ColorAnimation for a SpotLight-object, but it doesn’t seem to work.
What am I doing wrong?

ColorAnimation mouseEnterColorAnimation = new ColorAnimation();
mouseEnterColorAnimation.To = Colors.Red;
mouseEnterColorAnimation.Duration = TimeSpan.FromSeconds(5);
Storyboard.SetTargetName(mouseEnterColorAnimation, "MyAnimatedBrush");

Storyboard.SetTargetProperty(mouseEnterColorAnimation, new PropertyPath(SpotLightAuditorium.Color));
Storyboard storyboard = new Storyboard();
storyboard.RepeatBehavior = RepeatBehavior.Forever;
storyboard.Children.Add(mouseEnterColorAnimation);
storyboard.Begin(this);
  • 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-16T21:28:50+00:00Added an answer on May 16, 2026 at 9:28 pm

    When using Storyboard.SetTargetName, the name must be the value of the actual Name property of the FrameworkElement instance where you want to animate a property. So in your case probably an instance of the SpotLightAuditorium control:

    Storyboard.SetTargetName(mouseEnterColorAnimation, mySpotlightAuditorium.Name);
    

    The propertypath must be a reference to an actual dependency property:

    Storyboard.SetTargetProperty(mouseEnterColorAnimation, new PropertyPath(SpotLightAuditorium.ColorProperty));
    

    If you want to animate a Brush directly (wich doesn’t have a Name property) you have to register the name of the brush in the current Page/UserControl/Window using RegisterName This the same as using XAML x:Name.

    ALternativlely you can use the following approach for elements that derive from Animatable:

    ColorAnimation mouseEnterColorAnimation = new ColorAnimation();
    mouseEnterColorAnimation.To = Colors.Red;
    mouseEnterColorAnimation.Duration = TimeSpan.FromSeconds(5);
    myAnimatedBrush.BeginAnimation(SolidColorBrush.ColorProperty, null); // remove the old animation to prevent memoryleak
    myAnimatedBrush.BeginAnimation(SolidColorBrush.ColorProperty, mouseEnterColorAnimation);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

created an Eclipse plugin that contributes to the UI by a new project wizard
Created a new app with rails generate new_app -T and ran rails generate rspec:install
I created the HelloTabWidget tutorial app for android and cannot seem to make it
I created a new branch of my project and now when I try to
I have created a UserControl with two dependency properties: Value and Color. The Color
I've created DIV.cb-toggle, when the user hovers over this div, it animates to Orange,
I've created DIV.cb-toggle, when the user hovers over this div, it animates to Orange,
Created a very simple HTML/CSS drop down navigation using nested unordered lists. Works great
i created a datalayer using subsonic. however when i am selecting my data, i
I created a repository in my local machine: svnadmin create /home/me/Desktop/svn_test/trunk Then import myDir

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.