1

我有故事板:

    <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" 

由于某种原因不起作用

4

1 回答 1

2

您应该将 FadeInDuration 指定为 KeyTime 而不是 TimeSpan

IE:

<KeyTime x:Key="FadeInBeginTime">0:0:2.0</KeyTime>
于 2012-12-12T12:28:46.157 回答