0
votes

I'm quite new to windows universal app, I started to design my first app few days ago and I have problem setting white icons in task bar. It was easy in windows 8.1 but here no matter what I set for theme, battery, clock...always dark. Does anyone know how to change color?

Thanks

How app look now

3

3 Answers

3
votes

Although the answer you accepted is correct and you'll need the extension, it's better to 'not' check on device family. Because it could be that in the future this would change and other devices can also have the status bar! So use this to verify if one is available:

if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { ... }
1
votes

Use

var statusBar = StatusBar.GetForCurrentView();

Then set the ForegroundColor.

statusBar.ForegroundColor = Colors.White;

Sadly, it can no longer be done from Xaml without additional code.

-1
votes

You want to write code that runs only on a specific device family, in your case is Windows Mobile. To do that, add Window Mobile Extensions for the UWP.

enter image description here

As mentioned above you can add code in App.xaml.cs. It's oke, but I recommend first to check which platform will be used.

Here is a small snippet:

private void InitializeThemes()
    {
        switch (AnalyticsInfo.VersionInfo.DeviceFamily)
        {
            case "Windows.Mobile":
                StatusBar statusBar = StatusBar.GetForCurrentView();

                break;
            case "Windows.Desktop":
                ApplicationView applicationView = ApplicationView.GetForCurrentView();

                break;
        }
    }

As mentioned in the comments, the above solution is not suitable in your situation. Instead use the method that was described in @Depechie answer.