Im creating a WPF application and just wondering is there a way to use 24 hour duration. Right now my code looks like this:
<DoubleAnimation x:Name="Animation"
Storyboard.TargetName="hourHandTransform"
Storyboard.TargetProperty="Angle"
Duration="12:0:0" RepeatBehavior="Forever" To="360"/>
I tried setting the duration to 24 like this:
<DoubleAnimation x:Name="hourAnimation"
Storyboard.TargetName="hourHandTransfo开发者_高级运维rm"
Storyboard.TargetProperty="Angle"
Duration="24:0:0" RepeatBehavior="Forever" To="360"/>
But this gave me a error.. And when running the application il get:
Or maybe somebody have some good ideas how do create animation with duration of 24 hours?
Duration is a TimeSpan object (see MSDN here: http://msdn.microsoft.com/en-us/library/system.windows.duration.timespan.aspx)
This being so, you should use Duration="1.0:00"
See my answer here for more: TimeSpan and "24:00" parse error in Asp.net MVC
In summary: TimeSpan.Parse("1.0:00").TotalHours
returns 24
精彩评论