I recently created a site which contained a Silverlight (surprise surprise!) web part of fixed size as designed, however the users requested that it should be maximised with the SharePoint menus and headings removed to increase the footprint of the application. I didn't want to change the site definition master page, so decided to create a stripped down master page with only a ribbon and an application page with the SL app hard coded into the page to allow it to resize properly.
I need to acknowledge Randy Drisgill for the base master pages. I stripped down the _starter_foundation.master page to look like the following (sorry about the lack of colour, it was making the browser rendering too slow):
I deployed the page to the masterpage gallery with the following module (elements.xml):
The next step was to create an appication page, which is fairly straight forward, however there is a trick to get the new master page to load. The dynamic master page assignment is removed from the markup and then the new master page is assigned on page initialisation.
C# Code Behind:
The master page is assigned during initialisation because custom master pages can't be dynamically assined to app pages in markup. I originally deployed the page to the _layouts folder for testing and was able to use the DynamicMasterPageFile="~masterurl/default.master" attribute in the Page element and override it in the PreInit method, however once I moved it to a library so it could be scoped at site collection level, this did not work and produced the following error :
Removing this attribute (as the markup shows) works fine and simply allows the master to be assigned at runtime.
The app page is deployed to a document library using the following module (elements.xml):
The page should look like this (obviously you would have some content in the app page!):