Search code examples
c#asynchronouswindows-phone-8.1statusbar

Show and hide Statusbar in Windows Phone 8.1 just work first time


I´m using statusbar when loading things from internet into the app. I have two functions in App.xaml.cs which I use to hide and show but when I have called HideProgressAsync() once, next time I call ShowProgressAsync the status bar is not showed. What am I doing wrong? Missing a flag?

    public async Task ShowProgressAsync(string message)
    {
        var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();              
        statusBar.ProgressIndicator.Text = message;
        await statusBar.ProgressIndicator.ShowAsync();
    }

    public async Task HideProgressAsync()
    {
        var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
        await statusBar.HideAsync();
    }

Solution

  • Code issue, in code above I hide the whole statusBar. Below is correct code

    public async Task HideProgressAsync()
    {
        var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
        await statusBar.ProgressIndicator.HideAsync();
    }