Windows 8 apps - simple animation when button is clicked?

我只是一个虾纸丫 提交于 2019-12-24 07:09:58

问题


so I'm putting 2 same-sized StackPanels in the same position. The Visibility of the first StackPanel is Visible, while the second is Collapsed. Then I add this code to my button:

    private async void Button_Clicked(object sender, RoutedEventArgs e)
    {
         StackPanel1.Visibility = Visibility.Collapsed;
         StackPanel2.Visibility = Visibility.Visible;
    }

this simply makes the first StackPanel gone and the second to be visible.

However, I would like to add a simple animation that will make the first StackPanel fade off to the left to disappear and the second StackPanel comes to alive from the right. Is this possible?


回答1:


You can see this MSDN post about animations. the animation you're looking for is the fade in/out animation. You'll find the code of the fade in animation here



来源:https://stackoverflow.com/questions/13156135/windows-8-apps-simple-animation-when-button-is-clicked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!