0
votes

Let's say I have this storyboard:

<Storyboard x:Key="sbScale">
   <DoubleAnimation Duration="0:0:0.5"
      Storyboard.TargetProperty="LayoutTransform.ScaleX" 
      To="2.0"/>
</Storyboard>

If I need to use the same constant 2.0 many times, I can replace it with Double object:

xmlns:sys="clr-namespace:System;assembly=mscorlib"
...
<sys:Double x:Key="maxScale">2.0</sys:Double>
...
<Storyboard x:Key="sbScale">
   <DoubleAnimation Duration="0:0:0.5" 
      Storyboard.TargetProperty="LayoutTransform.ScaleX" 
      To="{StaticResource maxScale}"/>
</Storyboard>

How can I do the same with Duration? I tried sys:String, but it gives runtime exception.

1

1 Answers

1
votes

Define it as a duration:

<Duration x:Key="duration">0:0:0.5</Duration>