I have tried to set up a click event for a button that opens another window,but the error I'm getting at NavigationService
is that the project doesn't contain a definition for it.
This is how I'm trying to call the page at present:
private void conditioningBtn_Click(object sender, RoutedEventArgs e)
{
this.NavigationService.Navigate(new Uri("TrainingFrm.xaml", UriKind.RelativeOrAbsolute));
}
Can someone point me in the right direction with this or show alternatives to this method for window navigation?
Best Answer
NavigationService is for browser navigation within WPF. What you are trying to do is change to a different window
TrainingFrm
.To go to a different window, you should do this:
If, on the other hand, you want your WPF application to behave like a browser, then you would need to create
Page
s instead of Forms, and then use aFrame
in your application to do the navigation. See this example.