Windows 10 UWP – Template 10 Mobile Status Bar

Windows-Dev

Template 10 is a set of Visual Studio project templates for Windows 10 XAML / C# apps.

In my previous post I set the app theme to Light and found that the status bar was completely white on Windows 10 Mobile. The status icons were no longer visible.

Before we can make changes to the status bar we first need to add Windows Mobile Extensions for the UWP  to our references:

In the Solution Explorer right click on References and then click Add Reference. In the left pane select Universal Windows and then Extensions from the drop down menu. In the right hand pane select Windows Mobile Extensions for the UWP and click OK.

Now we can customize the status bar by adding the highlighted code to App.xaml.cs.

public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // TODO: add your long-running task here
            await NavigationService.NavigateAsync(typeof(Views.MainPage));
           
            //Set StatusBar background and foreground colors
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))

            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundOpacity = 1;
                    statusBar.BackgroundColor = Colors.Orange;
                    statusBar.ForegroundColor = Colors.White;
                }

Next just add the required using statements as prompted by Visual Studio.

As you can see I set the background color to orange and the text to white:

uwp-status-bar

Sources:

View story at Medium.com

https://stenobot.wordpress.com/2015/07/08/uwp-app-development-styling-the-mobile-status-bar/

https://blogs.msdn.microsoft.com/gianlucb/2015/10/08/uwp-windows-10-app-titlebar-and-status-bar-customization/

Advertisements

Visual Studio 2013 – Quick Troubleshooting

VisualStudioLogo

I ran into a couple of small issues with Visual Studio 2013 today. First I moved my Projects folder into my OneDrive folder so that I could easily sync projects between machines. After that I uninstalled all of my instances of Visual Studio and then just installed Visual Studio 2013 Express.

When I tried to open a project from my OneDrive folder Visual Studio threw up an error saying Visual Studio only supports Windows Store Apps.

This was fixed by making the Projects  folder available offline in OneDrive. I had tried to make it available earlier but it was still syncing and then I forgot to do it again …

After uninstalling and then reinstalling Visual Studio I found that there was not any emulator available and building a solution gave me the following errors:

  • There were deployment errors
  • HRESULT: 0x89721500

This was resolved by deleting all of the folders in C:\Users\<username>\AppData\Local\Microsoft\Phone Tools\CoreCon\ except for the highest numbered one which in my case was 12.0.

I deleted folders 10.0 and 11.0 just to be 100% clear.