Windows 10 UWP – Template 10 Mobile Status Bar


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:



View story at

Windows 10 UWP – Setting a Light Theme in Template 10


Template 10 is a set of Visual Studio project templates for Window 10 XAML / C# apps. By default Template 10 uses the Dark theme.

If you need to switch the Light theme you can add the following code to App.xaml in <common:Bootstrapper:


To see this change in the designer, save changes and restart Visual Studio.

Template 10 – Error CS0234 The type or namespace name ‘ApplicationInsights’ does not exist


Template 10 is set of Visual Studio templates for Windows 10 UWP C# and XAML applications. For those who are interested there is a whole course about Template 10 on the Microsoft Virtual Academy site.

Once you have installed Template 10 via NuGet you will find that your project fails to build with the following error:

Error CS0234 The type or namespace name ‘ApplicationInsights’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)

The solution is to add the following references to ApplicationInsights in project.json dependencies:

	"Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
	"Microsoft.ApplicationInsights": "1.0.0", 
	"Microsoft.ApplicationInsights.WindowsApps": "1.0.0",

You should then be able to build and run your Template 10 project.

The full project.json is as follows:

  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
	"Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
	"Microsoft.ApplicationInsights": "1.0.0", 
	"Microsoft.ApplicationInsights.WindowsApps": "1.0.0", 
    "Microsoft.Xaml.Behaviors.Uwp.Managed": "1.1.0",
    "Newtonsoft.Json": "8.0.3",
    "Template10": "1.1.*"
  "frameworks": {
    "uap10.0": {}
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}


Windows Runtime – Special Characters in JSON (Parsed as HTML)


My app in progress uses a JSON data file that is parsed as HTML so that I can add bold and other useful HTML attributes to my data.

Until today, none of the special characters that I used within my bold tags presented any issues: *, ?, [ ], { }, !, >, >>

But, when I got the to the less than sign it was parsed as the opening of another HTML tag, and broke my lovely bold tags!

The solution was simple enough – simply encode the less than sign as I would in standard HTML, thus: &lt;

So even though it works on WordPress, this is wrong:


And this is right:


Happy coding!

Windows Runtime – C# Send EMail from App


I’m working on my About page for a Windows Phone Runtime app and needed to be able to send an email for feedback or support issues.

Below is the code for my event handler in the code behind (AboutPage.cs):

        async private void Image_Email(object sender, TappedRoutedEventArgs e)
            //Define email address to send to
            EmailRecipient sendTo = new EmailRecipient()
                Address = ""

            //New email and define email subject
            EmailMessage mail = new EmailMessage();
            mail.Subject = "Linux Essentials - Feedback";

            //Add addressee to email

            //Open share contact with email only
            await EmailManager.ShowComposeNewEmailAsync(mail);

The XAML on my About page is simply an image with the Tapped event:

      <Image Source="Assets/Images/Mail.png"

When defining a new email you can also specify the mail body text:

mail.Body = "this is the Body";


Windows Runtime – C# Launch Hyperlink


I’m working on my About page for a Windows Phone Runtime app and needed to open a hyperlink in my code behind (AboutPage.cs).

Below is the code for my Tapped event handler:

        private void Image_Wordpress(object sender, TappedRoutedEventArgs e)
            Launcher.LaunchUriAsync(new Uri(""));

The XAML on my About page is simply an image with the Tapped event:

      <Image Source="Assets/Images/Wordpress.png"