Content.IsFullScreen Property

Silverlight

Gets or sets a value that indicates whether the Silverlight plug-in is displaying in full-screen mode.

Namespace:  System.Windows.Interop
Assembly:  System.Windows (in System.Windows.dll)

'Declaration
Public Property IsFullScreen As Boolean

Property Value

Type: System.Boolean
true if the Silverlight plug-in displays as a full-screen plug-in. false if the Silverlight plug-in displays as an embedded plug-in.

You can set this property only in response to a user-initiated action except in trusted applications. In trusted applications, you can enter full-screen mode in (for example) a Application.Startup or FrameworkElement.Loaded event handler. However, you must do so by setting the IsFullScreen property in a delegate passed to the Dispatcher.BeginInvoke method.

For more information, see Full-Screen Support.

NoteNote:

For best performance, when your application goes into full screen, hide or disconnect from the tree all of the objects that are not being rendered in full-screen mode. You can hide an object by setting its Visibility property to Collapsed.

The following code example demonstrates how to use this property.


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


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: