RepeatBehavior="Forever"
set to True
, so this animation will run forever which gets initiated with duration set to 0:0:1.
If you remove RepeatBehavior="Forever"
and hook on an event say MouseLeftButtonDown
, it works as expected.
However, in case you want to update it with RepeatBehavior="Forever"
, you need to stop animation first, set duration and than restart animation
.
Set name on storyBoard:
<Storyboard Storyboard.TargetName="borUpperTranslate"
Storyboard.TargetProperty="X" Name="storyboard">
And in handler:
Slider sl = sender as Slider;
storyboard.Stop();
dbaUpperTranslate.Duration = new Duration(TimeSpan.FromSeconds(sl.Value));
storyboard.Begin();
Moreover, if you don't want jerky look, you should consider removing From
attribute, so it will resume from where it left before stopping animation.