如何用c#和xaml编写动态DoubleAnimationUsingKeyFrames

时间:2017-10-15 09:19:27

标签: c# visual-studio xaml uwp

我用DoubleAnimationUsingKeyFrames编写了静态动画:

<Storyboard x:Name="MyCount" Completed="MyCount_Completed">
            <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetName="MyProgressBar" Storyboard.TargetProperty="(RangeBase.Value)">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="100"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:1" Value="90"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:2" Value="80"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:3" Value="70"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:4" Value="60"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:5" Value="50"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:6" Value="40"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:7" Value="30"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:8" Value="20"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:9" Value="10"/>
                <DiscreteDoubleKeyFrame KeyTime="0:0:10" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

现在我想用c#使这段代码(值和时间部分)动态化。 我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

const char *

在您的视图模型或您的数据上下文类中:

std::exception