Category Archives: Monogame

Adding Privacy Statement to Windows 8 Store App Built With Monogame

This has been covered many times on the web, but when using Monogame it isn’t as straightforward (not that it’s rocket science).

The key thing is to make sure that when creating the Monogame project, it is created using Monogame and XAML (I’ve blogged about this previously here).

In App.xaml.cs, add the following function to call your privacy statement:

Private async privacyCommandInvoked(Windows.UI.Popups.IUICommand command)
    Uri uri = new Uri(""");
    await Launcher.LaunchUriAsync(uri);

As far as I’m aware, it is a requirement of the Win 8 approval process that this be a web site; that is, it can’t simply be a XAML page that displays the text.

Now create a function to add this to the menu, and an event to handle it when it’s selected:

private AddFlyouts()
    var settingsPane = SettingsPane.GetForCurrentView();
    settingsPane.CommandsRequested += settingsPane_CommandsRequested;

void settingsPane_CommandsRequested(Windows.UI.ApplicationSettings.SettingsPane sender, Windows.UI.ApplicationSettings.SettingsPaneCommandsRequestedEventArgs args)
    commandHelp = new SettingsCommand("privacy", "Privacy Policy", privacyCommandInvoked);

You’ll need to change the OnLaunched event to call `AddFlyouts();` and you should be set.  

Remember that this will launch a web browser, so you may need to handle the suspend / resume events to deal with that.

Monogame with XAML – how to use both


I haven’t written anything for a while, but I spent a good while on the issue below, so I thought I’d share.

The Problem

I recently starting playing with MonoGame. I’d previously dabbled with using Javascript and HTML5; you can see the results here.

Being predominantly a C# programmer, I decided to try a similar thing using the Monogame framework. When you install Monogame, you’re faced with a box, asking you to either start a Monogame project, or a Monogame with XAML project:


So, what’s the difference?

I searched for this on-line, but found more or less nothing; consequently, I thought: what do I need XAML for if I’m writing a game?

And I was right – you don’t… that is, unless you’re using anything later than VS2010 (in which case it allows you to display text without the ridiculous palava that you HAVE to go through otherwise, just to get a FONT into your game.

Having made my decision, I went through this rigmarole, and moved onto the next part of the game: I needed to display a Microsoft Ad Control… which is a XAML control.

So, unless you KNOW that you don’t need XAML… and my guess is that you DON’T, then select XAML & Monogame. You can migrate your code across at a later time though; if you’ve structured your code properly then it may only be a 20 minute job.

Having transferred to use XAML, the question does arise as to how. It’s by no means clear, and I found no documentation at all.

Interacting With XAML / Benefits of having XAML

Annoyingly, I haven’t found any real way to interact with the game graphics from the XAML or vice-versa. It looks like you’d have to keep the instance of the main game page and talk to that from the game logic.

Without this though, you can simply overlay the game graphics on top of the XAML and that seems to work fine. In order to position my ad control I just created the following XAML:

            <ColumnDefinition Width="180"/>
            <ColumnDefinition Width="*"/>
        <UI:AdControl Grid.Column="0"                      

Another benefit that I didn’t consider until I moved across is all the resume suspend logic (that is so important in Windows 8 apps).


That’s pretty much all I’ve got to say about this. It’s not an ideal way of doing things, but Monogame is worth using, and it’s free (at least until you want to deploy to Android or something – at which point you pay).