我有故事板:
<Storyboard x:Key="St1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="imageBlue">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
我想提取keyTime值并将其放在某处。换句话说,我一直试图让这项工作:
<UserControl.Resources>
<sys:TimeSpan x:Key="FadeInBeginTime">0:0:2</sys:TimeSpan>
<Duration x:Key="FadeInDuration">0:0:1</Duration>
<Storyboard x:Key="St1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="imageBlue">
<EasingDoubleKeyFrame KeyTime={StaticResource FadeInDuration}" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
注意我正在使用命名空间:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
由于某些原因不起作用
答案 0 :(得分:2)
您应该将FadeInDuration指定为KeyTime而不是TimeSpan
即:
<KeyTime x:Key="FadeInBeginTime">0:0:2.0</KeyTime>