資訊
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

Silverlight

Gets or sets the main application UI.

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

public UIElement RootVisual { get; set; }

Property Value

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

ExceptionCondition
InvalidOperationException

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.


using System.Windows; // Application, StartupEventArgs

namespace SilverlightApplication
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Specify the main application UI
            this.RootVisual = new Page();
        }
    }
}


Silverlight

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.

社群新增項目

顯示:
© 2014 Microsoft