I am spinning a 3D house with the following code inside a storyboard:
<DoubleAnimation Storyboard.TargetName="HouseRotate" Storyboard.TargetProperty="Angle" From="0" To="-359" Duration="{Binding StringFormat=0:0:{0}, ElementName=slDuration, Path=Value, UpdateSourceTrigger=PropertyChanged}" RepeatBehavior="Forever"/>
I want the duration property to change based on the slider value, but it seems to be stuck at 1 second. I know the value of the slider is changing properly, because I have outputted it to a label.
In my opinion you need a proper converter in order to convert from
double
(Slider
's property Value returns adouble
) to a Duration struct.Take a look to this simple example:
Where the convert's code is:
Keep in consideration that it is not possible to change the animation's duration while it is running. You can change it just when it is idle.