Xaml Windows Phone幻灯片动画

Xaml Windows Phone幻灯片动画,xaml,windows-phone-7,animation,windows-phone-8,storyboard,Xaml,Windows Phone 7,Animation,Windows Phone 8,Storyboard,我需要设置水平堆叠面板内按钮的动画,以滑入屏幕的中心 <Grid Grid.Row="1" Grid.ColumnSpan="3"> <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden"> <StackPanel Orientation="Horizontal">

我需要设置水平堆叠面板内按钮的动画,以滑入屏幕的中心

<Grid Grid.Row="1" Grid.ColumnSpan="3">
        <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden">
            <StackPanel Orientation="Horizontal">

                <Button Name="Button1" Content="Button 1" />
                <Button Name="Button2" Content="Button 2" />
                <Button Name="Button3" Content="Button 3" />
            </StackPanel>
        </ScrollViewer>
    </Grid>

我知道我需要用故事板来制作动画。我没有用故事板很多,因此我不擅长它

我可能需要使用下面这样的东西-

<Button.RenderTransform>
        <TranslateTransform x:Name="translateTransform" X="500" />
</Button.RenderTransform>

然后对其应用一些故事板动画

但是故事板动画代码会是什么样子呢

<DoubleAnimation Storyboard.TargetName="translateTransform"
                 Storyboard.TargetProperty="X"
                 From="500" To="0" Duration="0:0:1"/>

上面的代码将一个按钮从一个位置滑动到另一个位置

但我需要一个更通用的解决方案,它将应用于stackpanel内的所有按钮/控件,以便所有按钮都滑到屏幕中央

<Grid Grid.Row="1" Grid.ColumnSpan="3">
        <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden">
            <StackPanel Orientation="Horizontal">

                <Button Name="Button1" Content="Button 1" />
                <Button Name="Button2" Content="Button 2" />
                <Button Name="Button3" Content="Button 3" />
            </StackPanel>
        </ScrollViewer>
    </Grid>

非常感谢您的帮助

拿我的一个老答案来说,把那个例子中的网格换成StackPanel,你就可以得到你想要的了。@ChrisW。我看到并尝试了你的例子。但这并不是我想要的。在您的示例中,整个网格将滑入。我希望网格中的元素从左向右滑动到网格的中心。或者在我的例子中-StackPanelRight,因此您只需将动画放在StackPanel上,并调整X设置以适合您。