Search code examples
c#timerwinrt-xamlappbar

How do I show, then hide the AppBar after a page loads?


After the page is visible to the user, I want the TopAppBar to show up for a second or two, then set IsOpen to false to close the AppBar. In essence I just want to briefly show the user the functionality I am hiding in the TopAppBar. I'm not sure where to place the code or how to implement the timer in XAML/C#.

Thank you for your help!


Solution

  • Nevermind, I figured it out, just call this function in the LoadState:

        private async void DelayedAppBarHide()
        {
            await Task.Delay(1000);
            this.TopAppBar.IsOpen = true;
            await Task.Delay(3000);
            this.TopAppBar.IsOpen = false;
    
        }