原文: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. 5.7-GTID复制搭建

    基本环境   Master Slave MySQL版本 MySQL-5.7.16-X86_64 MySQL-5.7.16-X86_64 IP 192.168.56.156 192.168.56.157 ...

  2. [Ramda] Rewrite if..else with Ramda ifElse

    From: const onSeachClick = (searchTerm) => { if(searchTerm !== '') { searchForMovies(searchTerm) ...

  3. java-synchronized原理

    介绍 synchronized是一种独占式的重量级锁,在运行到同步方法或者同步代码块的时候,让程序的运行级别由用户态切换到内核态,把所有的线程挂起,通过操作系统的指令,去调度线程.这样会频繁出现程序运 ...

  4. python request get

    import requests from urllib import parse # 返回response resp = requests.get("https://www.baidu.co ...

  5. Android Studio如何打jar包

    前言 公司经常和客户提供SDK,提供一个jar包sdk是一件很平常的事.Eclipse 有图形界面和向导供开发者将一个项目导出为jar包,相对来讲是比较简单的,切换到Android Studio后,则 ...

  6. SQL Server如何使用OPENQUERY访问另一个SQL Server

    在项目中,经常会遇到一个数据库访问另一个数据库,[CNVFERPDB]为服务器名,[CE3]为库名 SELECT Dtl.* FROM CNVFERPDB. CE3.ce3.ZTLE0125 Dtl ...

  7. MyEclipse各种版本号注冊码

    一:MyEclipse_6.0.1GA_E3.3.1_FullStackInstaller注冊码 Subscriber:javp Subscription Code:wLR7ZL-655551-685 ...

  8. vista/win7系统 红警/CS/星际争霸 局域网连接方法

    昨晚,闲来无事,忽然想起打红警来,于是和宿舍舍友商量一起联机打红警, 可是在win7下不能联机红警,网上很多人都这么说,昨晚我折腾了2小时,终于解决了这个问题. win7系统是可以联机打红警的!!!! ...

  9. javascript常用的基础函数或方法——写给新手的我(持续补充)

    1常用基础函数 alert函数:显示一个警告对话框,包括一个OK按钮.这就是传说中的警告框,此框一弹,世界就清静了.举例:   alert("我一旦出现,之前出现的就算了,我屁股后面你们就歇 ...

  10. mysql安装出现应用程序无法正常启动(oxc000007b)的解决方案

    原文:mysql安装出现应用程序无法正常启动(oxc000007b)的解决方案 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/IUNIQUE/art ...