How to set a startup page in WPF?

Posted by Peermohamedmydeen under WPF on 11/2/2010 | Points: 10 | Views : 14265 | Status : [Member] | Replies : 1
Hello All,

Nice Day,

I want to set a different page as my startup page in a WPF application...

I tried with the following, But I could not able to get the this.RootVisual

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();
}
}
}





Responses

Posted by: Peermohamedmydeen on: 11/2/2010 [Member] Bronze | Points: 25

Up
0
Down
Hello All,

I got the idea. I have changed in App.xaml file instead of App.xaml.cs.

In App.xaml, we have Application tag. There we need to set the following.


<Application x:Class="XYZ.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">



here I changed the MainWindow.xaml to Page1.xaml.

Thanks

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response