The Content..::.IsFullScreen property determines whether the Silverlight plug-in displays as a full-screen plug-in or as an embedded plug-in. If you set the IsFullScreen property to true, the Silverlight plug-in displays in full-screen mode; otherwise, the plug-in displays in embedded mode. If a Web page hosts multiple Silverlight plug-ins, only one plug-in can be in full-screen mode at one time. Additionally, the plug-in will not display any HTML content in full-screen mode. This prevents full-screen HTML overlay effects using windowless mode.
When a Silverlight plug-in displays in full-screen mode, it briefly displays the message "Press ESC to exit full-screen mode". This message alerts the user that the application is now in full-screen mode, and provides information about how to return to embedded mode.
Full-screen mode message
.png)
A Silverlight plug-in can enable full-screen mode only in response to a user-initiated action. This means that you can programmatically switch to full-screen mode only in a user-input event handler. If you try to set the IsFullScreen property to true in a Startup event handler, for example, the property setting is ignored. Limiting the actions that enable full-screen mode ensures that the user is always the initiator of full-screen mode behavior. This prevents malicious applications from spoofing the appearance of the operating system or other programs.
Note: |
|---|
You should avoid using OpenFileDialog and SaveFileDialog in full screen mode. |
When a Silverlight plug-in is in full-screen mode, it disables most keyboard events. This limitation of keyboard input during full-screen mode is a security feature, and is intended to minimize the possibility of unintended information being entered by a user. In full-screen mode, the only input allowed is through the following keys.
UP ARROW, DOWN ARROW, LEFT ARROW, RIGHT ARROW, SPACEBAR, TAB, PAGE UP, PAGE DOWN, HOME, END, ENTER
The Silverlight plug-in does not support OpenFileDialog and SaveFileDialog in full-screen mode. In most cases, displaying one of these dialog boxes in full-screen mode will cause the plug-in to revert to embedded mode. However, to avoid issues on some browsers, you should exit full-screen mode before using these classes.
Multitouch input is not supported in full-screen mode.
The following code example shows how to enable and disable full-screen mode for a Silverlight plug-in by toggling the IsFullScreen property value.
Private WithEvents rootPage As Page = New Page()
Private WithEvents htmlContent As Content
Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
Me.RootVisual = rootPage
htmlContent = Me.Host.Content
End Sub
Private Sub ToggleFullScreen(ByVal sender As Object, _
ByVal e As MouseButtonEventArgs) Handles rootPage.MouseLeftButtonDown
Me.Host.Content.IsFullScreen = Not Me.Host.Content.IsFullScreen
End Sub
Private Sub DisplaySizeInformation( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles htmlContent.FullScreenChanged, htmlContent.Resized
Dim message As String = String.Format( _
"ActualWidth={0}, ActualHeight={1}", _
Me.Host.Content.ActualWidth, _
Me.Host.Content.ActualHeight)
rootPage.LayoutRoot.Children.Clear()
Dim t As New TextBlock()
t.Text = message
rootPage.LayoutRoot.Children.Add(t)
End Sub
Page rootPage = new Page();
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = rootPage;
rootPage.LayoutRoot.MouseLeftButtonDown +=
delegate(Object s, MouseButtonEventArgs args) {
this.Host.Content.IsFullScreen =
!this.Host.Content.IsFullScreen;
};
this.Host.Content.FullScreenChanged +=
new EventHandler(DisplaySizeInformation);
this.Host.Content.Resized +=
new EventHandler(DisplaySizeInformation);
}
private void DisplaySizeInformation(Object sender, EventArgs e)
{
String message = String.Format(
"ActualWidth={0}, ActualHeight={1}",
this.Host.Content.ActualWidth,
this.Host.Content.ActualHeight);
rootPage.LayoutRoot.Children.Clear();
rootPage.LayoutRoot.Children.Add(
new TextBlock { Text = message });
}
The Size of the Plug-in in Full-Screen Mode
When a Silverlight plug-in is displayed in full-screen mode, the plug-in's size is equal to the current resolution of the screen. However, the values of the width and height properties of the plug-in are not affected during the switch to full-screen mode. To determine the true size of the plug-in in full-screen mode, use the Content..::.ActualWidth and Content..::.ActualHeight properties. In full-screen mode, these properties are set to the current resolution of the screen.
When a Silverlight plug-in in full-screen mode switches back to embedded mode, the plug-in size reverts to the values of the width and height properties.
For more information about the width and height properties, see Property Values of the HTML Object Element.
Performance Characteristics During a Mode Change
Switching between embedded and full-screen modes has minimal effect on performance for content that is contained within the Silverlight plug-in. This means, in most cases, that the playback of audio or video content is seamless.
Note: |
|---|
For best performance, when your application goes into full-screen mode, hide or disconnect from the tree all objects that are not being rendered in full-screen mode. You can hide an object by setting its Visibility property to Collapsed. |
Full-Screen Windowless Silverlight Plug-Ins
A Silverlight plug-in whose Windowless property is set to true always draws its background color at full opacity when displayed in full-screen mode. However, when the Silverlight plug-in returns to embedded mode, the background color reverts to its previous opacity value.
Returning to Embedded Mode
A Silverlight plug-in that is in full-screen mode can return to embedded mode in several ways. The simplest way to leave full-screen mode is for the user to enter a keystroke or keystroke combination:
In addition, if a Silverlight plug-in that is in full-screen mode loses focus, it returns to embedded mode. A Silverlight plug-in in full-screen mode can lose focus in a multi-monitor configuration when another window gains focus through a user action. For example, switching between tasks in Windows by using the ALT+TAB key combination causes the current application to lose focus and the next application to gain focus.
Setting the IsFullScreen Property to False
When a Silverlight plug-in is displayed in full-screen mode, setting the IsFullScreen property to false returns the plug-in to embedded mode. When a Silverlight plug-in switches back to embedded mode from full-screen mode, the plug-in size reverts to the values of the width and height properties.