WPF页面跳转在实际程序开发中是经常会被用到的一个功能需求。在实现WPF页面跳转这一功能的时候,可以分为两种情况,分别为:前台跳转和后台跳转。#t#
WPF页面跳转之前台转:
- < TextBlock FontSize="24"
TextWrapping="Wrap"
Margin="0,0,0,-19.998"> - < Hyperlink x:Name="LnkPre"
NavigateUri="Page2.xaml"
Foreground="Black"> - Enter Page2
- < /Hyperlink>
- < /TextBlock>
WPF页面跳转之后台转:
- NavigationService.GetNaviga
tionService(this).Navigate
(new Uri("Page2.xaml",
UriKind.Relative));- NavigationService.GetNavi
gationService(this).GoForward();
向后转- NavigationService.GetNavi
gationService(this).GoBack();
向前转- if (Application.Current.
Properties["TaskResult"]
== null) return;- bool taskResult = (bool)
Application.Current.Properties
["TaskResult"];- if (!taskResult) return;
- // If a task happened,
display task data- string taskData = (string)
Application.Current.Properties
["TaskData"];- if (taskData == null) return;
- // "End" the task be removing
state associated with- // its existence
- Application.Current.Properties
["TaskResult"] = null;- Application.Current.Properties
["TaskData"] = null;