In WPF how do we define Duration as a resource?
I have a du开发者_开发问答ration (0:0:0.5) that I use in a number of animations and I would like to define this number at one place only. I can define a double for instance as
<Window.Resources>
<sys:Double x:Key="GridWidth">400</sys:Double>
</Window.Resources>
But not sure how a duration should be expressed as a resource. Thanks.
<Window.Resources>
<Duration x:Key="aDuration">0:0:0.5</Duration>
</Window.Resources>
In general, you can look at the MSDN doc for the type to see if they give XAML syntax. In the case of WPF types, there usually is: http://msdn.microsoft.com/en-us/library/ms602372.aspx.
精彩评论