原文:UWP入门(七)--SplitView详解与页面跳转

官方文档,逼着自己用英文看,UWP开发离不开官方文档

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覆盖掉content

  • Inline

    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推开content

  • CompactOverlay

    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详解与页面跳转的更多相关文章

  1. js中window对象详解以及页面跳转

    1.window.top.window.location = "index.asp"; 2.window.top.location.href="index.asp&quo ...

  2. 经典Spring入门基础教程详解

    经典Spring入门基础教程详解 https://pan.baidu.com/s/1c016cI#list/path=%2Fsharelink2319398594-201713320584085%2F ...

  3. 详解vue 路由跳转四种方式 (带参数)

    详解vue 路由跳转四种方式 (带参数):https://www.jb51.net/article/160401.htm 1.  router-link ? 1 2 3 4 5 6 7 8 9 10 ...

  4. 【IOS 开发】Object-C 入门 Xcode 环境详解

    作者 : 韩曙亮 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/38424965 一. Xcode 环境安装 与 工程创建 1. ...

  5. 使用IDEA创建Maven项目和Maven使用入门(配图详解)

    本文详解的讲解了使用IDEA创建Maven项目,及Maven的基础入门. 1.打开IDEA,右上角选择File->New->Project 2.如图中所示选择Maven(可按自己所需添加, ...

  6. Solr安装入门、查询详解

    Solr安装入门:http://www.importnew.com/12607.html 查询详解:http://www.360doc.com/content/14/0306/18/203871_35 ...

  7. (Dos)/BAT命令入门与高级技巧详解(转)

    目录 第一章 批处理基础 第一节 常用批处理内部命令简介 1.REM 和 :: 2.ECHO 和 @ 3.PAUSE 4.ERRORLEVEL 5.TITLE 6.COLOR 7.mode 配置系统设 ...

  8. 音视频入门-11-PNG文件格式详解

    * 音视频入门文章目录 * PNG 文件格式解析 PNG 图像格式文件由一个 8 字节的 PNG 文件署名域和 3 个以上的后续数据块(IHDR.IDAT.IEND)组成. PNG 文件包括 8 字节 ...

  9. 音视频入门-14-JPEG文件格式详解

    * 音视频入门文章目录 * JPEG 文件格式解析 JPEG 文件使用的数据存储方式有多种.最常用的格式称为 JPEG 文件交换格式(JPEG File Interchange Format,JFIF ...

随机推荐

  1. 关系型数据库工作原理-快速缓存(翻译自Coding-Geek文章)

    本文翻译自Coding-Geek文章:< How does a relational database work>. 原文链接:http://coding-geek.com/how-dat ...

  2. 第二十一篇:基​于​W​D​M​模​型​的​A​V​S​t​r​e​a​m​驱​动​架​构​研​究

    基​于​W​D​M​模​型​的​A​V​S​t​r​e​a​m​驱​动​架​构​研​ 这篇论文2006年早就发表, 与当时开发这个驱动正好几乎相同的时间. 近期实际项目须要, 又回过头来将AVStre ...

  3. 如何在CSDN博客自定义栏目中添加“给我写信”

    在"自定义栏目"中添加"连接"(将自己的微博,QQ空间和CSDN博客关联起来)很多人都做过.但是添加"给我写信"这个功能,用的好像不太多.此 ...

  4. hive 日志配置/表头配置

    1.日志配置,拷贝hive/conf下的hive-log4j2.properties.template为hive-log4j2.properties,修改日志目录,接下来在创建hive/logs,目录 ...

  5. 在JS中var、let和const的区别

    var有变量提升 x = 4; // 变量 x 设置为 4 console.log(x)  //输出 4 var x; // 声明 x 上面代码相当于下面的 var x; // 声明 xx = 4;  ...

  6. hadoop 3.x 服役 | 退役数据节点

    在服役前要配置好新增主机的环境变量,ssh等信息,个人环境介绍 hadoop002(namenode),hadoop003(resourcemanager),hadoop004(secondaryna ...

  7. 【a302】&&【9306】贮油点问题

    Time Limit: 1 second Memory Limit: 2 MB 问题描述 一辆重型卡车欲穿过1000公里的沙漠,卡车耗油为1升/公里,卡车总载油能力为500公升.显然卡车装 一次油是过 ...

  8. 反编译Jar包

    Jar 包(Java Archive)是对 Java 程序的打包,它可能包含源码,也可能没有. 对于有包含源码的 Jar 包,在 Eclipse 工程里设定好 source code 路径后能直接查看 ...

  9. template.js小小说明

    教程 template.js 一款 JavaScript 模板引擎,简单,好用.提供一套模板语法,用户可以写一个模板区块,每次根据传入的数据,生成对应数据产生的HTML片段,渲染不同的效果. 简介 主 ...

  10. Hibernate——(2)增删改查

    案例名称:Hibernate完成增删改查 案例描述:抽取出工具类并完成删除.修改.查询功能. 具体过程: 1.使用上面的例子(Hibernate--(1)Hibernate入门http://blog. ...