Sometimes, it may be necessary to hide some controls on the page, for example, when they are no longer active or important for a user. Of course, you can easily change their visibility, but is it possible to hide a control with an animation? Of course! In this recipe, you will learn how to fade out the text block once you press the button.
To modify the preceding example to fade out the text block after pressing the button, perform the following steps:
Define the storyboard with the fade out animation in the page resources and add a button to start the animation. Perform this step by modifying the content of the
MainPage.xaml
file, as shown in the following code snippet:<Page (...)> <Page.Resources> <Storyboard x:Name="HeaderHide"> <FadeOutThemeAnimation ...