Windows Phone Expression Blend - 如何反转故事板/动画

时间:2014-01-12 22:16:01

标签: windows-phone-8 expression-blend

编辑:我使用ToggleButton及其CheckedStates解决了它:更多信息here

我有一个故事板,当我按下按钮时,用户控件滑入视图。我希望能够再次按下相同的按钮,动画会反转,用户控制会滑开。

这是故事板代码:

     <Storyboard x:Name="SettingsScrollUp" AutoReverse="False">
        <DoubleAnimation Duration="0:0:1" To="-189" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="btn_Import" d:IsOptimized="True">
            <DoubleAnimation.EasingFunction>
                <QuarticEase EasingMode="EaseOut"/>
            </DoubleAnimation.EasingFunction>
        </DoubleAnimation>
        <DoubleAnimation Duration="0:0:1" To="-189" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="btn_Settings" d:IsOptimized="True">
            <DoubleAnimation.EasingFunction>
                <QuarticEase EasingMode="EaseOut"/>
            </DoubleAnimation.EasingFunction>
        </DoubleAnimation>
        <DoubleAnimation Duration="0:0:1" To="-189" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="SettingsPopup" d:IsOptimized="True">
            <DoubleAnimation.EasingFunction>
                <QuarticEase EasingMode="EaseOut"/>
            </DoubleAnimation.EasingFunction>
        </DoubleAnimation>
        <DoubleAnimation Duration="0:0:1" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="btn_Import" d:IsOptimized="True">
            <DoubleAnimation.EasingFunction>
                <QuinticEase EasingMode="EaseOut"/>
            </DoubleAnimation.EasingFunction>
        </DoubleAnimation>
    </Storyboard>

1 个答案:

答案 0 :(得分:0)

我使用切换按钮解决了这个问题,并触发了Checked和UnChecked事件中的动画。更多信息here