MonoGame XAML Support

Dec 4, 2012 at 11:15 AM


any plans to support MonoGame XAML Templates ?

I'm using pubCenter and AdDuplex, both are working in the XAML Templates. 

But Ad Rotator does not work (is not displayed).


The Idea behin this : 

Having a XNA Game (Mono) for windows 8 and a XAML SwapChainBackgroundPanel infromt of it.

Dec 4, 2012 at 11:53 AM

The Windows 8 version of AdRotator should work like any other XAML component in a MonoGame XAML project.  Haven't tested in that scenario but i'll check and get back to you.  It's just a UserControl so there shouldn't be any reason it shouldn't work.

The desktop MonoGame template wouldn't work at the moment obviously, that would have to use the MonoGame specific version which is only available in V1 at the moment (untested with MonoGame Desktop on Win 8)

Dec 4, 2012 at 1:11 PM
Edited Dec 4, 2012 at 1:20 PM

I've installed AdRotator via 

PM> Install-Package AdRotatorWin8

so i got Version 1.0.7.


This is the code i use in my "GamePage.xaml"

<AdRotatorWin8:AdRotatorControl x:Name="AdRotatorWin8"

My defaultAddSettings.xml

<?xml version="1.0" encoding="utf-8"?>
<AdSettings xmlns:xsi="" xmlns:xsd="">
		<AdCultureDescriptor CultureName="default">
      <Probabilities Probability="80" AdType="PubCenter" AppID="3a13517c-938a-4ea0-a1fb-72efed0190d3" SecondaryID="105788" />
      <Probabilities Probability="20" AdType="AdDuplex" AppID="26907"/>

The Remote Settings file is still online, so you can check. But i see nothing :/

If i try it with the adduplex or pubcenter controll, everything works fine

        <adduplex:AdControl x:Name="ad" 


// Edit : i've tried the setting.xml and defaultAdSettings.xml in the AdRotatorExampleWin8 and everything works well.

// Edit : I also tried to put the AdRotatorWin8:AdRotatorControl inside a Border like in the examples. Now i see the border but no ads :/

Dec 4, 2012 at 1:51 PM

Just tested in a fresh MonoGame project and using your config above it's working.


Have you completed all the steps from the instructions including calling "AdRotatorWin8.Invalidate();" in your CodeBehind in the "Loaded" Event?

        public GamePage(string launchArguments)

            // Create the game.
            _game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);

            Loaded += GamePage_Loaded;

        void GamePage_Loaded(object sender, RoutedEventArgs e)

If you don't call "Invalidate", AdRotator won't start fetching Ads.

Putting the AdRotator control in a Border shouldn't stop it from generating Ads, also if you intend to use the control in multiple pages we recommend putting it in your own user control and reusing that rather than fresh instances on each page.

Dec 4, 2012 at 3:59 PM

No, i have not called AdRotatorWin8.Invalidate();

I'm sure this will fix my Problem (willl check it later, have to do some stuff in linux and don't want to reboot now)

You should add this IMPORTANT info MORE present here

I've found this sentence (after reading it again) : Then call the "Invalidate" function from your code behind, for best results we suggest doing this in the "Loaded" event handler....

But this really important info somehow gets lost in the text ;)

I have to admit that i only read the "Code" Part of this docu the first time. Maybe you should add this

void GamePage_Loaded(object sender, RoutedEventArgs e)


as a Code part too.

Anyway: Thank you for your help and sorry you had to waste so much time on this :)

Dec 4, 2012 at 4:18 PM

Fair point, I do go into more detail in the tutorial if you follow the link at the bottom of the documentation.

But I will add your comments to the page, thanks.

Dec 4, 2012 at 5:04 PM

AdRotatorWin8.Invalidate(); solved my problem :) 

Now everything is ready and i can submit my game to the marketplace (OK i still need a Splashscreen, icons and screenshots, so tomorrow will be submission day ! ) :)

Dec 11, 2012 at 12:40 PM

Windows 8 NuGet package updated, check it out and let me know