UWP入门(七)--SplitView详解与页面跳转
1. SplitView 拆分视图控件
拆分视图控件具有一个可展开/可折叠的窗格和一个内容区域
<SplitView>
<SplitView.Content>
singleObject
</SplitView.Content>
<SplitView.Pane>
singleObject
</SplitView.Pane>
</SplitView>
A split view’s content area is always visible. The pane can expand and collapse or remain in an open state, and can present itself from either the left side or right side of an app window. The pane has four modes:
Overlay
The pane is hidden until opened. When open, the pane overlays the content area.
pane不打开是隐藏,打开的时候pane覆盖掉contentInline
The pane is always visible and doesn’t overlay the content area. The pane and content areas divide the available screen real estate.
pane不打开是隐藏,打开的时候pane推开contentCompactOverlay
A narrow portion of the pane is always visible in this mode, which is just wide enough to show icons. The default closed pane width is 48px, which can be modified with CompactPaneLength. If the pane is opened, it will overlay the content area.
不打开时,pane留下一点宽度,默认48px,可以用CompactPaneLength修改CompactInline
A narrow portion of the pane is always visible in this mode, which is just wide enough to show icons. The default closed pane width is 48px, which can be modified with CompactPaneLength. If the pane is opened, it will reduce the space available for content, pushing the content out of its way.
不打开时,pane留下一点宽度,默认48px,可以用CompactPaneLength修改
2. 页面跳转和SplitView,用static传递了数据
方便你找代码,直接目录跳转
2.1 MainPage
<StackPanel>
<StackPanel Orientation="Horizontal">
<Button Name="HomeButton" Content="Home" Click="HomeButton_Click" Margin="0,0,20,0" />
<Button Name="BackButton" Content="Back" Click="BackButton_Click" Margin="0,0,20,0" />
<Button Name="ForwardButton" Content="Forward" Click="ForwardButton_Click" Margin="0,0,20,0" />
<Button Name="NavigateButton" Content="Navigate Root Frame" Click="NavigateButton_Click" />
</StackPanel>
<Frame Name="MyFrame">
</Frame>
</StackPanel>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
//自己有Frme,布局里面的
MyFrame.Navigate(typeof(Page1));
}
private void HomeButton_Click(object sender, RoutedEventArgs e)
{
MyFrame.Navigate(typeof(Page1));
}
private void BackButton_Click(object sender, RoutedEventArgs e)
{
//haha,不用自己写堆栈
if (MyFrame.CanGoBack)
{
MyFrame.GoBack();
}
}
private void ForwardButton_Click(object sender, RoutedEventArgs e)
{
if (MyFrame.CanGoForward)
{
MyFrame.GoForward();
}
}
private void NavigateButton_Click(object sender, RoutedEventArgs e)
{
//注意,这会替换整个页面的Frame
this.Frame.Navigate(typeof(Page2));
}
}
2.2 App.xml.cs
//只可以在应用内访问
internal static string SomeImportantValue;
2.3 Page1
<StackPanel>
<TextBlock FontSize="48" Text="Page 1" />
<HyperlinkButton Content="Go to Page 2" Click="HyperlinkButton_Click" />
<HyperlinkButton Content="Go to Microsoft.com" NavigateUri="http://www.microsoft.com" />
</StackPanel>
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(Page2));
}
2.4 Page2
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
App.SomeImportantValue = ValueTextBox.Text;
Frame.Navigate(typeof(Page3), ValueTextBox.Text);
// Frame.Navigate(typeof(Page3), "DEVIL");
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (!String.IsNullOrEmpty(App.SomeImportantValue))
{
ValueTextBox.Text = App.SomeImportantValue;
}
}
<StackPanel>
<TextBlock FontSize="48" Text="Page 2" />
<TextBox Name="ValueTextBox" Width="200" />
<HyperlinkButton Content="Go to Page 3" Click="HyperlinkButton_Click" />
</StackPanel>
2.5 Page3
<StackPanel>
<TextBlock FontSize="48" Text="Page 3" />
<TextBox Name="ValueTextBox" Width="200" />
</StackPanel>
//页面刚打开的时候调用
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var value = (string)e.Parameter;
ValueTextBox.Text = value;
}
UWP入门(七)--SplitView详解与页面跳转的更多相关文章
- js中window对象详解以及页面跳转
1.window.top.window.location = "index.asp"; 2.window.top.location.href="index.asp&quo ...
- 经典Spring入门基础教程详解
经典Spring入门基础教程详解 https://pan.baidu.com/s/1c016cI#list/path=%2Fsharelink2319398594-201713320584085%2F ...
- 详解vue 路由跳转四种方式 (带参数)
详解vue 路由跳转四种方式 (带参数):https://www.jb51.net/article/160401.htm 1. router-link ? 1 2 3 4 5 6 7 8 9 10 ...
- 【IOS 开发】Object-C 入门 Xcode 环境详解
作者 : 韩曙亮 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/38424965 一. Xcode 环境安装 与 工程创建 1. ...
- 使用IDEA创建Maven项目和Maven使用入门(配图详解)
本文详解的讲解了使用IDEA创建Maven项目,及Maven的基础入门. 1.打开IDEA,右上角选择File->New->Project 2.如图中所示选择Maven(可按自己所需添加, ...
- Solr安装入门、查询详解
Solr安装入门:http://www.importnew.com/12607.html 查询详解:http://www.360doc.com/content/14/0306/18/203871_35 ...
- (Dos)/BAT命令入门与高级技巧详解(转)
目录 第一章 批处理基础 第一节 常用批处理内部命令简介 1.REM 和 :: 2.ECHO 和 @ 3.PAUSE 4.ERRORLEVEL 5.TITLE 6.COLOR 7.mode 配置系统设 ...
- 音视频入门-11-PNG文件格式详解
* 音视频入门文章目录 * PNG 文件格式解析 PNG 图像格式文件由一个 8 字节的 PNG 文件署名域和 3 个以上的后续数据块(IHDR.IDAT.IEND)组成. PNG 文件包括 8 字节 ...
- 音视频入门-14-JPEG文件格式详解
* 音视频入门文章目录 * JPEG 文件格式解析 JPEG 文件使用的数据存储方式有多种.最常用的格式称为 JPEG 文件交换格式(JPEG File Interchange Format,JFIF ...
随机推荐
- Erlang学习笔记2
http://wgcode.iteye.com/blog/1007623 第二章 入门 1.所有的变量都必须以大写字母开头,如果要查看某个变量,只要输入变量的名字即可,如果一个变量被赋予值,就称为绑定 ...
- erlang抽象码与basho的protobuf
erlang抽象码与basho的protobuf(一)使用 erlang抽象码与basho的protobuf(二)代码生成原理之词法与语法分析 erlang抽象码与basho的protobuf(三)代 ...
- JNI基础
1.JNI概述 JNI 是 Java Native Interface 的缩写,中文译为“Java 本地调用”.通俗的说JNI是一种技术,通过这种技术我们可以做到以下两点: 1)Java 程序中的函 ...
- 一个里程碑,新网站实现全站https
本地验证node服务没问题后,上传到阿里云服务器上,发现无法访问.一开始以为是SSL证书有问题,去腾讯云SSL证书重新下载,还是不行.然后改node应用文件代码app.js,猜测是crt证书应该改成p ...
- Vue Router的官方示例改造
基于Vue Router 2018年8月的官方文档示例,改造一下,通过一个最简单的例子,解决很多初学者的一个困惑. 首先是官方文档示例代码 <!DOCTYPE html> <html ...
- Java背景
Java语言是美国Sun公司(Stanford University Network),在1995年推出的高级编程语言 2009年Oracle甲骨文公司收购Sun公司
- Android Studio入门(安装-->开发调试)
写在前面的话:本文来源:http://blog.csdn.net/yanbober/article/details/45306483 目标:Android Studio新手–>下载安装配置–&g ...
- 防爆搜索解决方案hdu1572下沙面(2)
#include<iostream> #include<map> #include<string> #include<cstring> #include ...
- WPF 中那些可跨线程访问的 DispatcherObject(WPF Free Threaded Dispatcher Object)
原文 WPF 中那些可跨线程访问的 DispatcherObject(WPF Free Threaded Dispatcher Object) 众所周知的,WPF 中多数对象都继承自 Dispatch ...
- myeclipse 8.6 software and workspace center is currently not available
Myeclipse安装EGit插件的时候偏偏遇到software and workspace center is currently not available 不用打开myeclipse conf ...