WPF页面跳转实现方法详解

开发 开发工具
WPF页面跳转对于初学者来说,掌握起来还是比较简单的。主要分为前台的WPF页面跳转和后天的跳转之分。在这里为大家做一个简要的介绍。

WPF页面跳转在实际程序开发中是经常会被用到的一个功能需求。在实现WPF页面跳转这一功能的时候,可以分为两种情况,分别为:前台跳转和后台跳转。#t#

WPF页面跳转之前台转:

 

  1. < TextBlock FontSize="24" 
    TextWrapping="Wrap" 
    Margin="0,0,0,-19.998"> 
  2. < Hyperlink x:Name="LnkPre"
     NavigateUri="Page2.xaml" 
    Foreground="Black"> 
  3. Enter Page2  
  4. < /Hyperlink> 
  5. < /TextBlock> 

 

WPF页面跳转之后台转:

 

  1. NavigationService.GetNaviga
    tionService(this).Navigate
    (new Uri("Page2.xaml", 
    UriKind.Relative));  
  2. NavigationService.GetNavi
    gationService(this).GoForward();
    向后转  
  3. NavigationService.GetNavi
    gationService(this).GoBack(); 
     向前转  
  4. if (Application.Current.
    Properties["TaskResult"] 
    == null) return;  
  5. bool taskResult = (bool)
    Application.Current.Properties
    ["TaskResult"];  
  6. if (!taskResult) return;  
  7. // If a task happened, 
    display task data  
  8. string taskData = (string)
    Application.Current.Properties
    ["TaskData"];  
  9. if (taskData == null) return;  
  10. // "End" the task be removing 
    state associated with   
  11. // its existence  
  12. Application.Current.Properties
    ["TaskResult"] = null;  
  13. Application.Current.Properties
    ["TaskData"] = null; 

 

责任编辑:曹凯 来源: 博客园
相关推荐

2009-02-17 10:40:26

页面跳转JSP教程

2009-12-16 17:24:26

Ruby on Rai

2009-07-03 17:24:31

Servlet页面跳转

2021-05-18 09:49:08

鸿蒙HarmonyOS应用

2009-12-02 20:02:18

PHP实现页面跳转

2009-12-02 19:42:24

PHP页面自动跳转

2009-12-28 16:10:38

WPF生成文件

2009-07-24 13:01:44

ASP.NET页面跳转

2009-07-02 09:25:41

JSP实现页面跳转

2009-12-28 16:00:36

WPF样式继承

2009-12-28 13:28:03

WPF视频

2011-05-11 16:54:49

JSP

2010-08-05 09:39:17

Flex页面跳转

2012-04-19 16:41:24

Titanium视频实现页面跳转

2009-12-11 13:25:01

PHP页面跳转

2015-05-05 10:51:32

php页面跳转方法

2009-07-03 17:48:24

JSP页面跳转

2009-12-28 17:33:19

WPF视频音频

2009-12-28 11:14:29

WPF显示文本

2009-12-24 13:31:25

WPF UI设计
点赞
收藏

51CTO技术栈公众号