25 May, 2012

Silverlight + XNA Full size render with System Tray and ApplicationBar

While developing a XNA +  Silverlight App (a Libra port for Windows Phone 7) the XNA rendered page wasn't occupying the whole screen.
After some googling i arrived at Samuel Blanchard blog (its in french) with the answer.
Turns out the System tray and the Application bar rendering is done differently from the rest of the page. And the System tray acts like the Application bar when it's opacity isn't set to 1 (they don't resize the screen area).
So, by setting the opacity of the System tray and the ApplicationBar to 0.99 and then adding margins equal to their height to the LayoutRoot I've managed to get a full XNA rendered layout with System Tray and ApplicationBar.

Opacity settings
shell:SystemTray.Opacity="0.99"
shell:ApplicationBar IsVisible="True" Opacity="0.99"

LayoutRoot margins (SystemTray Height = 32; ApplicationBar Height = 72)
Grid x:Name="LayoutRoot" Margin="0,32,0,72"