WPF页面跳转在实际程序开发中是经常会被用到的一个功能需求。在实现WPF页面跳转这一功能的时候,可以分为两种情况,分别为:前台跳转和后台跳转。#t#
WPF页面跳转之前台转:
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;
上一篇:WPF触发器在代码执行中作用体现
下一篇:WPF线程渲染相关疑难问题解答