locked
Change status bar content uwp RRS feed

  • Question

  • I want to change the content for my status bar on windows 10 mobile i want to add a text and remove some icons

    I can only find a codes for change back color and foreground color ...

    Here's my code

             if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    if (statusBar != null)
                    {
                        statusBar.BackgroundOpacity = 1;
                        statusBar.BackgroundColor = (Color)this.Resources["SystemAccentColor"];
                        statusBar.ForegroundColor = Colors.White;
                    }


    Thursday, September 7, 2017 1:19 PM

All replies

  • You can add text which will then be shown instead of most icons:

    StatusBarProgressIndicator indicator = StatusBar.GetForCurrentView().ProgressIndicator;
    indicator.ProgressValue = 0.5;
    indicator.Text = "Your text";
    await indicator.ShowAsync();

    Thursday, September 7, 2017 6:13 PM
  • Hi louay

    I found a same question in stackChange status bar content UWP mobile. Is that you who asked the same problem. It seems that you have solved the problem, I’ll help you post @Marian Dolinský’s answer here, you could mark this as answer and this could help others who are facing the same problem.

    @Marian Dolinský’s answer

    AFAIK they achieved it using StatusBarProgressIndicator. With this you don't have to create clock by yourself.

    Haven't tested it myself but this should work:

     if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    StatusBar statusBar = StatusBar.GetForCurrentView();
                    statusBar.ForegroundColor = YourForegroundColor;
                    statusBar.BackgroundColor = YourBackgroundColor;
                    statusBar.BackgroundOpacity = 1.0;
    
                    StatusBarProgressIndicator indicator = statusBar.ProgressIndicator;
    
                    indicator.ProgressValue = null; // May not be needed, depends on its default value
                    indicator.Text = "Some text shown in status bar";
                    await indicator.ShowAsync();
                }

    Note: This response contains a reference to a third part World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

      

    Best Regards

    Roy 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, September 8, 2017 2:42 AM
  • @louay

    Any updates?

    Have you solved your problem?

    Please feel free to contact us if you have problems

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 14, 2017 8:35 AM