手把手玩转win8开发系列课程(24)

我们这节有两个议题①创建另外的视图②测试导航程序

(1)创建另外的视图

现在,我需要的做的事情就是添加另一个页面来完善这个程序。这个页面名字叫做DetailPage,他的源代码如图所示:

 1 <Page
 2   x:Class="MetroGrocer.Pages.DetailPage"
 3   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 4   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 5   xmlns:local="using:MetroGrocer.Pages"
 6   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 7   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 8   mc:Ignorable="d">
 9    <!--Grid 布局控件  背景颜色是ApplicationPageBackgroundBrush定义的-->
10   <Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
11      <!--stackpanel布局控件 垂直对齐居中 水平对齐居中-->
12     <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
13      <!--textblock 文本框控件  绑定的样式HeaderTextStyle-->
14     <TextBlock Style="{StaticResource HeaderTextStyle}" Text="Detail View"/>
15     </StackPanel>
16   </Grid>
17 </Page>

至于他完成什么动作,并不完成什么动作,他的存在只不过处理如何导航

(2)测试导航

万事俱备只欠东风,下列我们所做的就是测试页面之间如何导航,下图展示了程序运行的最终结果,你会看到了底部的appBar和头部的NavBar。

appBar的控件能够很好不错的继承与这个导航的控件确实不错,当然了,你也可以继承了单个的appBar控件,但你要想好这些移去或者添加按钮是所需要了。

哝——相应的导航,操作控件就完全集成于项目中了。



原文地址:https://www.cnblogs.com/manuosex/p/2809763.html