Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Application.RootVisual Property


Gets or sets the main application UI.

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

Public Property RootVisual As UIElement

Property Value

Type: System.Windows.UIElement
A UIElement that is the main application UI.


When setting this property, the specified value is not an instance of a class that derives from UIElement.

You can set the value of the RootVisual property only one time from code, although you get its value any number of times.

The following code example demonstrates how an application can use a Startup event handler to set the RootVisual property.

Partial Public Class App
    Inherits Application

    public Sub New()
    End Sub

    Private Sub Application_Startup(ByVal o As Object, _
        ByVal e As StartupEventArgs) Handles Me.Startup

        Me.RootVisual = New Page()

    End Sub

End Class


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

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

© 2018 Microsoft