Tuesday, February 16, 2010

Full Screen Applications

Often there is a need to run a Silverlight application full screen. This is often achieved by creating a small button or a link which toggles the application to full screen and using an escape sequence toggling back to small area within your website. The code to do this is quite simple and straight forward:


{
if (!Application.Current.Host.Content.IsFullScreen)
{
Application.Current.Host.Content.IsFullScreen = true;
}
else
{
Application.Current.HostContent.IsFullScreen= false;
}


The explanation to this piece is quite simple so here its is - the if statement checks the current state if the app screen is in full screen mode or not. The if condition starts of by asking If Application is Not full screen then do something in this case set it to full screen or else do something else (in this case set back the app mode from full screen to its original state running within the web page.)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.