You are developing a Silverlight 4 application. The application has a user control named HomePage.xaml and an Application class named App.xaml. HomePage.xaml must be displayed when the application is started. You need to set HomePage.xaml as the initial page of the application. What should you do?
A.
Create the following constructor for the Application class.
public App()
{
InitializeComponent();
var homePage = new HomePage();
homePage.Visibility = Visibility.Visible;
}
B.
Create the following constructor for the Application class.
public App() {
InitializeComponent();
this.MainWindow.SetValue(UserControl.ContentProperty, new HomePage());
}
C.
Create the following event handler for the Application.Startup event.
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new HomePage();
}
D.
Create the following event handler for the Application.Startup event.
private void Application_Startup(object sender, StartupEventArgs e)
{
var homePage = new HomePage(); homePage.SetValue(HomePage.ContentProperty, this.MainWindow); this.MainWindow.Activate();
}