There are two types of page redirects: windows and page.
1: windows page Jump
Windows page Jump I believe anyone who has learned winform programming knows that you can instantiate the form and then show it. eg: there are two forms: Main and Login. to Click the register button on the Login form and jump to the Main, the code in the Click Event of the Login form is as follows: main Mn = new Main (); Mn. show ();
2: Page Jump: Both foreground jump and background jump can be achieved at the front end:
<TextBlockFontSize = "24" TextWrapping = "Wrap" Margin = "0, 0, 0">
<Hyperlinkx: Name = "LnkPre" NavigateUri = "Page1.xaml" Foreground = "Black">
Enter Page1
</Hyperlink>
</TextBlock>
Background implementation:
NavigationService. GetNavigationService (this). Navigate (new Uri ("Page1.xaml", UriKind. Relative ));
NavigationService. GetNavigationService (this). GoForward (); // backward
NavigationService. GetNavigationService (this). GoBack (); // forward
You can also write this in the background: this. content = new Page1 (); (this is relatively simple, but we recommend that you use the previous one to improve yourself)
In addition, you can jump to the page through windows:
NavigationWindow window = new NavigationWindow ();
Window. Source = new Uri ("Page1.xaml", UriKind. Relative );
Window. Show ();