Forcing a dark theme on Windows Phone Universal Apps

While the introduction of Windows 8.1 and Windows 10 has done a lot to clean up the look of apps, Windows Phone still allows you to give your phone a light theme which can make your app look weird. This requires you to do additional testing for your apps and optionally hard code colors for some elements on the screen.

In 2013, I described how to force a dark theme on Windows Phone silverlight apps, but things have changed when it comes to the newer universal apps.

The ApplicationBar has been replaced by the CommandBar, and is fortunately rather easy to theme in XAML. The following code will force your CommandBar into a dark theme.

<CommandBar Background="#1F1F1F" Foreground="White">