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

  • Home
  • SEARCH
  • 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 4085536
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:35:35+00:00 2026-05-20T18:35:35+00:00

I’m playing with WPF animation and faced a weird problem. I have a Slider

  • 0

I’m playing with WPF animation and faced a weird problem.

I have a Slider and a TextBox. TextBox is bound to Slider.Value using 2-way binding:

<StackPanel>
    <Slider x:Name="MySlider" Minimum="0" Maximum="100" Value="50" />
    <TextBox Text="{Binding ElementName=MySlider, Path=Value, Mode=TwoWay}" />
    <Button Click="Button_Click">Test</Button>
</StackPanel>

When I drag slider, text in textbox changes. When I change text in textbox, value of slider is updated, it works correctly.

Now I add an animation, which animates Slider.Value property to 0. I start it on button press.

private void Button_Click(object sender, RoutedEventArgs e)
{
    Storyboard storyboard = new Storyboard();
    var animation = new DoubleAnimation();

    animation.Duration = new Duration(TimeSpan.FromSeconds(0.5));
    animation.To = 0;

    Storyboard.SetTarget(animation, MySlider);
    Storyboard.SetTargetProperty(animation, new PropertyPath(Slider.ValueProperty));

    storyboard.Children.Add(animation);
     
    storyboard.Begin();
}

When I press button, animation scrolls Slider to 0. TextBox is also changes to 0 synchronously with slider.

And now I face the problem. After animation I cannot change text in the TextBox. I change text, move focus, and the text with slider value resets to 0. I still can move the Slider, and the TextBox updates with the Slider value. But I can’t set the Slider value using the TextBox.

I think when animation stops, the value somehow freezes on a value, specified in the animation.To property, but I can’t figure how to unfreeze it. Or maybe it is something else?

  • 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-20T18:35:36+00:00Added an answer on May 20, 2026 at 6:35 pm

    It happens because of dependency property value precedence, meaning that value set by animation has higher “priority” than value set via binding.

    Here is a quote from MSDN on how to workaround this:

    One way to regain control of an
    animated property in code is to use
    the BeginAnimation method and specify
    null for the AnimationTimeline
    parameter. For more information and an
    example, see How to: Set a Property
    After Animating It with a Storyboard
    .

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I've tracked down a weird MySQL problem to the two different ways I was
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.