02-实现页面的跳转的功能
2013-09-11 00:44
399 查看
1.主要的知识点:
NavigationService.navigate方法
实现步骤:
1.拖动添加工具箱中的button按钮到手机界面上,点中button按钮,右边的button标签背景色变为灰色,修改Content值为页面跳转
2.双击页面跳转按钮,进入代码编辑区
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace changePage
{
public partial class MainPage : PhoneApplicationPage
{
// 构造函数
public MainPage()
{
InitializeComponent();
}
//点击页面跳转按钮触发的方法,跳转到Welcome.xaml页面
private void button1_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Welcome.xaml", UriKind.Relative));
}
//页面跳转时触发的方法,让用户决定是否跳转页面
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
if (MessageBox.Show("确定要跳到下个页面吗?", "警告提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
{
e.Cancel = true;
}
}
}
}
3.创建跳转后的页面
4.新建页面
5.添加一个TextBlock,同样的修改里面的值
6.点击运行
运行效果:
NavigationService.navigate方法
实现步骤:
1.拖动添加工具箱中的button按钮到手机界面上,点中button按钮,右边的button标签背景色变为灰色,修改Content值为页面跳转
2.双击页面跳转按钮,进入代码编辑区
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace changePage
{
public partial class MainPage : PhoneApplicationPage
{
// 构造函数
public MainPage()
{
InitializeComponent();
}
//点击页面跳转按钮触发的方法,跳转到Welcome.xaml页面
private void button1_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Welcome.xaml", UriKind.Relative));
}
//页面跳转时触发的方法,让用户决定是否跳转页面
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
if (MessageBox.Show("确定要跳到下个页面吗?", "警告提示", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
{
e.Cancel = true;
}
}
}
}
3.创建跳转后的页面
4.新建页面
5.添加一个TextBlock,同样的修改里面的值
6.点击运行
运行效果:
相关文章推荐
- 一些页面自动跳转的实现 (功能:5秒后,自动跳转到同目录下的02view.html文件)
- 实现淘宝商品详情页面的viewPager滑动到最后一张图片跳转的功能
- 微信小程序实现点击文字页面跳转功能【附源码下载】
- jsp实现n秒后页面自动跳转功能
- Android利用CountDownTimer实现倒计时功能 Android实现停留5s跳转到登录页面
- Flex实现页面跳转的功能可用性分析
- jsp实现分页和页面跳转功能
- JavaScript实现倒计时跳转页面功能【实用】
- ajax实现异步请求,不跳转页面的情况下,达到检验用户名等信息是否效果的功能!
- require.js与bootstrap结合实现简单的页面登录和页面跳转功能
- ionic结合angularjs实现跳转到上个页面的功能
- php编写的简单页面跳转功能实现代码
- java servlet 几种页面跳转的方法,需要的朋友可以参考一下 在访问网页的过程中,页面自动刷新、跳转和重定向是经常用到的,这里就说说在Java中是如何实现这些功能的! 一、页面自动刷新
- avascript实现页面跳转功能,参数怎么传递?
- jsp实现分页(限定显示指定页数)和页面跳转功能
- 页面跳转到BackURL功能(基于struts2实现)
- Flex实现页面跳转的功能可用性分析
- 如何绑定android点击事件--跳转到另一个页面并实现关闭功能?
- 041医疗项目-模块四:采购单模块—采购单创建好之后跳转到采购单修改页面,然后实现修改采购单功能
- Flex实现页面跳转的功能可用性分析