Hi,
I want to navigate between pages within my WPF application in C#, but I am not sure if I am using the correct way.
Currently I am using this:
private void Register_Click(object sender, RoutedEventArgs e) { Register Register = new Register(); Register.WindowStartupLocation = WindowStartupLocation.CenterScreen; Register.Show(); this.Close(); }
I seen a example of using Method NavigationService.Navigate from this link.
private void TestPage_Click(object sender, RoutedEventArgs e) { this.NavigationService.Navigate(new Uri("TestPage.xaml", UriKind.Relative)); }
But I am getting this error:
Error 1 'WPF_Test.MainWindow' does not contain a definition for 'NavigationService' and no extension method 'NavigationService' accepting a first argument of type 'WPF_Test.MainWindow' could be found (are you missing a using directive or an assembly reference?) C:\Users\John\Dropbox\VS Projects\WPF Test\WPF Test\MainWindow.xaml.cs 29 18 WPF Test
I not sure where to add the definition for navigationservice. Everything I tried did not work. Please keep in mind I am a noob at programing, so I welcome any help.
Thanks,
John
John Lisenby developer of My PC Playbook