In WPF, how do we define Duration as a resource?

I have a duration (0: 0: 0.5) that I use in several animations, and I would like to determine this number in only one place. I can define double, for example, as

<Window.Resources>
    <sys:Double x:Key="GridWidth">400</sys:Double>
</Window.Resources>

But not sure how duration should be expressed as a resource. Thank.

+5
source share
1 answer
<Window.Resources>
    <Duration x:Key="aDuration">0:0:0.5</Duration>
</Window.Resources>

In general, you can look at the MSDN document for a type to see if they give XAML syntax. In the case of WPF types, there is usually: http://msdn.microsoft.com/en-us/library/ms602372.aspx .

+9
source

All Articles