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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:44:59+00:00 2026-06-13T22:44:59+00:00

I am developing wpf application in C#. The following xaml code is working fine

  • 0

I am developing wpf application in C#. The following xaml code is working fine for me.

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="VisualStateGroup">
        <VisualState x:Name="DefaultVisualState">
            <Storyboard/>
        </VisualState>
        <VisualState x:Name="FocusVisualState">
            <Storyboard>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="CircleEllipse1">
                    <EasingColorKeyFrame KeyTime="0" Value="#FF0004FF"/>
                </ColorAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Background).(SolidColorBrush.Color)" Storyboard.TargetName="TextBlock1">
                    <EasingColorKeyFrame KeyTime="0" Value="#FFBCB0B0"/>
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

The same code I have written in C#

EasingColorKeyFrame easingColorKeyFrameObj = new EasingColorKeyFrame();
easingColorKeyFrameObj.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));
easingColorKeyFrameObj.Value = Colors.Red;
ColorAnimationUsingKeyFrames colorAnimationUsingKeyFramesObj = new ColorAnimationUsingKeyFrames();
colorAnimationUsingKeyFramesObj.KeyFrames.Add(easingColorKeyFrameObj);
Storyboard.SetTargetName(colorAnimationUsingKeyFramesObj, "CircleEllipse1");
Storyboard.SetTargetProperty(
    colorAnimationUsingKeyFramesObj, new PropertyPath("Color"));

Storyboard myStoryboard = new Storyboard();
myStoryboard.Children.Add(colorAnimationUsingKeyFramesObj);

myStoryboard.Begin(this, true);

In the above code how should I set the Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" and Storyboard.TargetProperty="(TextElement.Background).(SolidColorBrush.Color)" in C#

  • 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-06-13T22:45:00+00:00Added an answer on June 13, 2026 at 10:45 pm

    You need to specify it as a string

    private void AnimateColor(string ellipseName, Color ellipseColor, string textBlockName, Color textBlockColor)
                {
                    EasingColorKeyFrame easingColorKeyFrameEllipseObj = new EasingColorKeyFrame();
                    easingColorKeyFrameEllipseObj.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(12));
                    easingColorKeyFrameEllipseObj.Value = ellipseColor;
    
                    ColorAnimationUsingKeyFrames colorAnimationUsingKeyFramesEllipseObj = new ColorAnimationUsingKeyFrames();
                    Storyboard.SetTargetName(colorAnimationUsingKeyFramesEllipseObj, ellipseName);
                    Storyboard.SetTargetProperty(
                        colorAnimationUsingKeyFramesEllipseObj, new PropertyPath("(Shape.Fill).(SolidColorBrush.Color)"));
                    colorAnimationUsingKeyFramesEllipseObj.KeyFrames.Add(easingColorKeyFrameEllipseObj);
    
                    EasingColorKeyFrame easingColorKeyFrameTextBlockObj = new EasingColorKeyFrame();
                    easingColorKeyFrameTextBlockObj.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(12));
                    easingColorKeyFrameTextBlockObj.Value = textBlockColor;
    
                    ColorAnimationUsingKeyFrames colorAnimationUsingKeyFramesTextBlockObj = new ColorAnimationUsingKeyFrames();
                    Storyboard.SetTargetName(colorAnimationUsingKeyFramesTextBlockObj, textBlockName);
                    Storyboard.SetTargetProperty(
                        colorAnimationUsingKeyFramesTextBlockObj, new PropertyPath("(TextElement.Background).(SolidColorBrush.Color)"));
                    colorAnimationUsingKeyFramesTextBlockObj.KeyFrames.Add(easingColorKeyFrameTextBlockObj);
    
    
                    Storyboard storyboard = new Storyboard();
    
                    storyboard.Children.Add(colorAnimationUsingKeyFramesEllipseObj);
                    storyboard.Children.Add(colorAnimationUsingKeyFramesTextBlockObj);
    
                    storyboard.Begin(this, true);
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing wpf application in C#. I am able to run the following
Possible Duplicate: MainWindow constructor getting called twice I am developing a WPF application following
I am developing a WPF application, that connects to several WCF services (that work
Context: I'm developing a WPF application which will contain a lot of different screens.
I am developing a WPF application that must run using Windows Classic theme. The
I am developing a WPF application, and I need your advice. I have to
I am developing a WPF application that must meet Section 508 (Accessibility) requirements. In
We are developing a WPF application which uses Telerik's suite of controls and everything
I'm developing a WPF application which reads and writes XML data. I'm coming from
Well, I´m developing a wpf application and I got a strange error on design

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.