Scenario:
I have a NavigationWindow style as follows:
<Style TargetType="NavigationWindow" x:Key="{x:Type NavigationWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="NavigationWindow" >
...
</Style>
I am launching my application with the loading of a page called Home.xaml. In Home.xaml, I have a button that goes to another page called PersonalData:
private void btnNewUser_Click(object sender, System.Windows.RoutedEventArgs e)
{
PersonalData personalData = new PersonalData();
this.NavigationService.Navigate(personalData);
}
This works great and the PersonalData page loads. On this second page, I have a Home button that will go to the main page:
private void btnHome_Click(object sender, System.Windows.RoutedEventArgs e)
{
Home home = new Home();
this.NavigationService.Navigate(home);
}
I use "Navigation" here because I want to use this button again in later forms, to always have a button leading to the start page.
So, this also works, and the Home page loads. I can even click btnNewUser there a second time and again, the PersonalData page opens without any problems.
, "" , "this.NavigationService".
WPF, , . -?