Monday 3 March 2014

How to change default start up page in WPF

How to change default start up page in WPF
Extensible Application Markup Language (XAML)
How to change default start up page in WPF
1.Add your own xaml page in the solution
2. Open Application.xaml (Visual Basic) or App.xaml (C#).
This XAML file defines a WPF application and any application resources. You also use this file to specify the UI that automatically shows when the application starts; in this case, MainWindow.xaml.
3.In the App.xaml page find the property “StartupUri” in “Application” tag.
4.Rplace “MainWindow.xaml” with your newly added xaml name.
EX: Add new Xaml page called MS.xaml
Now go to App.xaml and change below code.
private void Application_Startup(object sender, StartupEventArgs e)
{
//this.RootVisual = new MainPage();
this.RootVisual = new MS();
}