WPF page Jump

Source: Internet
Author: User

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 ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.