I'm trying to change duration of DoubleAnimation control by Slider's value but it does not get effect. I don't know why?
Here's my code:
XAML:
<Border.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard Storyboard.TargetName="borUpperTranslate" Storyboard.TargetProperty="X">
<DoubleAnimation Name="dbaUpperTranslate" From="418" To="230" Duration="0:0:1" RepeatBehavior="Forever" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
C#:
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Slider sl = sender as Slider;
dbaUpperTranslate.Duration = new Duration(TimeSpan.FromSeconds(sl.Value));
}
Any help would be appreciate! Thanks in advance.