Full screen can be toggled on and off via a user command such as a button click by setting the following property to true or false: Application.Current.Host.Content.IsFullScreen
Normally Silverlight applications will only stay in full screen mode until a user hits the <ESC> key or until the application loses focus. For example, if the user has multiple monitors and they click on another application in another monitor this will cause the Silverlight application to return to windowed mode. If you want to prevent your Silverlight application from leaving full screen mode in this case you can do so by setting:
Application.Current.Host.Content.FullScreenOptions =
System.Windows.Interop.FullScreenOptions.StaysFullScreenWhenUnfocused;
Now, when a user clicks on another application in another monitor they will be prompted with the following dialog:
If the user clicks ‘Remember my answer’ and the “Yes” button they will only need to be prompted this one time.
In the following demo below I have added a button that toggles full screen mode as well as an event that will update the status text to show whether we are in full screen mode or not:
App.Current.Host.Content.FullScreenChanged += ((sender, args) =>
{
if (App.Current.Host.Content.IsFullScreen)
{
ModeTB.Text = "Mode=Full Screen";
}
else
{
ModeTB.Text = "Mode=Windowed";
}
});
Demo:
[silverlight: Tip31_Pinning.xap]
Thanks,
–Mike






