开发者

In WPF how do we define Duration as a resource?

开发者 https://www.devze.com 2023-01-06 09:22 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消