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

这节的议程就是——添加appbar

appbar是出现在哪儿了,出现在屏幕的底部。他能使用户能用手势或者使用鼠标操作程序。metro UI 重点是在主要的控件使用许多控件,使其用户使用win8电脑更加的方便。而appBar使其用户体验更好。在这节中,我将告诉你如何定义和填充app Bar。

在界面的顶部有一个类似的控件,叫做navbar。这使其程序中,能够互相导航。 至于如何创建 使用navbar ,我将在后续文章详细的介绍。

定义一个appBar

我将用最简单的方法创建一个AppBar.下面源代码就是创建一个appBar:

 1 <Page2   x:Class="MetroGrocer.Pages.ListPage"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 Background="{StaticResource AppBackgroundColor}">
10     <Grid.RowDefinitions>
11       <RowDefinition/>
12       <RowDefinition/>
13     </Grid.RowDefinitions>
14     <Grid.ColumnDefinitions>
15       <ColumnDefinition/>
16       <ColumnDefinition/>
17     </Grid.ColumnDefinitions>
18     <StackPanel Grid.RowSpan="2">
19       <TextBlock Style="{StaticResource HeaderTextStyle}" Margin="10"
20             Text="Grocery List"/>
21       <ListView x:Name="groceryList" Grid.RowSpan="2"
22         ItemsSource="{Binding GroceryList}"
23         ItemTemplate="{StaticResource GroceryListItemTemplate}"
24         SelectionChanged="ListSelectionChanged" />
25     </StackPanel>
26     <StackPanel Orientation="Vertical" Grid.Column="1">
27       <TextBlock Style="{StaticResource HeaderTextStyle}" Margin="10"
28             Text="Item Detail"/>
29       <Frame x:Name="ItemDetailFrame"/>
30     </StackPanel>
31     <StackPanel Orientation="Vertical" Grid.Column="1" Grid.Row="1">
32       <TextBlock Style="{StaticResource HeaderTextStyle}" Margin="10"
33             Text="Store Detail"/>
34     </StackPanel>
35   </Grid>
36      <!--一个appbar控件定义的源代码-->
37   <Page.BottomAppBar>
38     <AppBar>
39       <Grid>
40           <!--Column 的定义-->
41         <Grid.ColumnDefinitions>
42           <ColumnDefinition />
43           <ColumnDefinition />
44         </Grid.ColumnDefinitions>
45          <!--垂直的显示-->
46         <StackPanel Orientation="Horizontal" Grid.Column="0"
47               HorizontalAlignment="Left">
48             <!--AppBar Button 控件 AppBarButtonClick 事件 -->
49           <Button x:Name="AppBarDoneButton"
50               Style="{StaticResource DoneAppBarButtonStyle}"
51               IsEnabled="false"
52               Click="AppBarButtonClick"/>
53         </StackPanel>
54         <StackPanel Orientation="Horizontal" Grid.Column="1"
55               HorizontalAlignment="Right">
56           <Button x:Name="AppBarAddButton"
57               Style="{StaticResource AddAppBarButtonStyle}"
58               AutomationProperties.Name="New Item"
59               Click="AppBarButtonClick"/>
60           <Button x:Name="AppBarStoresButton"
61               Style="{StaticResource StoresAppBarButton}"
62               Click="AppBarButtonClick"/>
63           <Button x:Name="AppBarZipButton"
64               Style="{StaticResource HomeAppBarButtonStyle}"
65               AutomationProperties.Name="Zip Code"
66               Click="AppBarButtonClick"/>
67         </StackPanel>
68       </Grid>
69     </AppBar>
70   </Page.BottomAppBar>
71 </Page>

为了创建appBar,我不得不创建一个appBar控件。因此,这创造appbar及其内容和属性包含了bottom Bar.

你可以创建一个通过类似方法在底部创建一个NavBar.

appbar工具条包含buttons按钮,这么做的规定是有按钮, 当前选择的显示在appBar左边,无选择的项目显示在右边。(也就是说,在win8的Consumer Preview版本中,这个用户体验的原则不完全,这将会正式版本会改变这个用户体验的原则)。

接下来的篇幅,我将会在AppBar 控件中添加Grid布局控件。这个Grid控件有1行2列。每列有一个stackpanel。 在appBar添加Button有两种方法。你可以选择在standardstyles.xaml定义,或者直接添加。

如何添加appBarButton,我将会在下面的篇幅中介绍。

转载于:https://www.cnblogs.com/manuosex/archive/2012/12/04/2801570.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/377037.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

No identities are available for signing 的解决办法

今天重新上传做好的app提交到app store&#xff0c;结果就出现标题上的错误。“No identities are available for signing”。 以后碰到这样的问题按照下面几个步骤来做&#xff1a; 进入Distribution -----下载发布证书 -----双击安装-----重启Xcode就能上传了 其他细节 如果再…

半连接反连接

半连接&反连接 1. 半连接 半连接返回左表中与右表至少匹配一次的数据行&#xff0c;通常体现为 EXISTS 或者 IN 子查询。左表驱动右表。只返回左表的数据&#xff0c;右表作为筛选条件。 可以用 EXISTS、 IN 或者 ANY 举例&#xff1a;表t1和表t2做半连接&#xff0c;t…

匿名方法和Lambda表达式

出于MVVM学习的需要&#xff0c;复习下匿名方法和Lambda表达式&#xff0c;因为之前用的也比较少&#xff0c;所以用的也不是很熟练&#xff0c;Baidu下相关的知识&#xff0c;写了这个Demo&#xff0c;目标是用简单的方法展示这个怎么用。 这里偏重的和LINQ中的Lambda表达式 …

烂橘子

Problem Statement: 问题陈述&#xff1a; Given a matrix of dimension r*c where each cell in the matrix can have values 0, 1 or 2 which has the following meaning: 给定尺寸r * C的矩阵&#xff0c;其中矩阵中的每个单元可以具有其具有以下含义的值0&#xff0c;1或2…

android junit 测试程序

http://blog.csdn.net/to_cm/article/details/5704783 Assert.assertEquals(2, t); 断言转载于:https://www.cnblogs.com/wjw334/p/3714120.html

MySQL 8.0.22执行器源码分析HashJoin —— BuildHashTable函数细节步骤

BuildHashTable函数细节步骤 该函数位置处于hash_join_iterator.cc 403 ~ 560行 step1&#xff1a;如果被驱动表迭代器没有更多的行数&#xff0c;更新m_state为EOR&#xff0c;然后返回false&#xff0c;表明创建hash表失败 if (!m_build_iterator_has_more_rows) {m_state…

《那些年啊,那些事——一个程序员的奋斗史》——125

距离离职交接的一个月时间还剩几天&#xff0c;本来应该是平淡无事的&#xff0c;却没想到最后还是波澜四起。昨天下班前&#xff0c;公司突然停了电。这本是件普通得不能再普通的事情&#xff0c;可没想到过了一会来电了&#xff0c;或许是波峰电压太大&#xff0c;或许是稳压…

python中的元类_Python中的元类

python中的元类Python元类 (Python metaclass) A metaclass is the class of a class. A class defines how an instance of a class i.e.; an object behaves whilst a metaclass defines how a class behaves. A class is an instance of a metaclass. 元类是类的类。 一个类…

MySQL 8.0.22执行器源码分析HashJoin —— 一些初始化函数的细节步骤

目录InitRowBuffer&#xff08;101行~126行&#xff09;InitProbeIterator&#xff08;142行~153行&#xff09;*HashJoinIterator* 的Init&#xff08;155行~240行&#xff09;InitializeChunkFiles&#xff08;364行~401行&#xff09;InitWritingToProbeRowSavingFile&#…

c语言的宏定义学习笔记

宏定义 在预处理之前&#xff0c;c预处理器会对代码进行翻译&#xff0c;譬如用blank替换注释&#xff0c;去掉多余的空格&#xff0c;删除末尾的\来拼接行等。 例如&#xff1a; int /*注释*/ x; 会被翻译成 int x; printf("this is a s\ entence."); 会被翻译成 pr…

摄氏温度转换华氏温度_什么是摄氏温度?

摄氏温度转换华氏温度摄氏温度 (Celsius) Celsius is a temperature measuring scale which as a SI unit derived from the seven base units stated and described by the International System of Units (SI). 摄氏温度是一种温度测量刻度&#xff0c;它是由国际单位制(SI)所…

别人的算法学习之路

http://www.cnblogs.com/figure9/p/3708351.html 我的算法学习之路 关于 严格来说&#xff0c;本文题目应该是我的数据结构和算法学习之路&#xff0c;但这个写法实在太绕口——况且CS中的算法往往暗指数据结构和算法&#xff08;例如算法导论指的实际上是数据结构和算法导论&a…

git config命令使用第二篇——section操作,多个key值操作,使用正则

接上一篇&#xff0c;git config命令使用第一篇——介绍&#xff0c;基本操作&#xff0c;增删改查:http://blog.csdn.net/hutaoer06051/article/details/8275069 1. 删除一个section 命令参数 --remove-section 格式&#xff1a;git config [--local|--global|--system] --rem…

MySQL面试准备——64页pdf

本笔记为以前整理的零碎的关于Mysql的知识点&#xff0c;有深入源码的也有浅层的八股。已经被我整理成了一个pdf。 实习岗位正好也是和数据库内核有关的&#xff0c;之后应该还会更新。做个整理&#xff0c;方便秋招的时候快速回顾吧。 链接&#xff1a;链接 提取码&#xff1a…

python点图_Python | 点图

python点图The dot plot is a type of data representation in which each data-point in the figure is represented as a dot. Dot plot underlies discrete functions unlike a continuous function in a line plot. Each value could be correlated but cannot be connecte…

SAP-MM:发票、贷方凭证、事后借记、后续贷记

发票和事后借记 相同点&#xff1a;增加对供应商的应付款 不同点&#xff1a;针对同一订单收货&#xff0c;发票要先于事后借记&#xff08;事后借记是对供应商后期发票金额的补充&#xff09;&#xff1b;发票和金额、订单数量有关系&#xff0c;而事后借记只是订单金额调整的…

Dijkstra for MapReduce (1)

<math xmlns"http://www.w3.org/1998/Math/MathML"><mi>x</mi><mo>,</mo><mi>y</mi><mo>&#x2208;<!-- ∈ --></mo><mi>X</mi> </math> 准备研究一下Dijkstra最短路径算法Hadoop上…

sql的外键约束和主键约束_SQL约束

sql的外键约束和主键约束SQL | 约束条件 (SQL | Constraints) Constraints are the guidelines implemented on the information sections of a table. These are utilized to restrict the kind of information that can go into a table. This guarantees the precision and …

nios pio interrupt 的使能

关于nios 中的中断&#xff0c;因为要16c550中需要nios的中断环境去测试&#xff0c;所以就用到了中断。 硬件&#xff1a;在nios中添加硬件PIO,但是要使能中断功能。如下图所示&#xff1a; 系统列化&#xff0c;PIO的连接就不说了。但是要注意两地方&#xff1a;edge type&am…

《单线程的build hash table、write rows to chunks、hash join的步骤以及流程图》

Build Hash Table流程 1、初始化row buffer2、从build input table中读一行3、若读完build input table所有row&#xff0c;返回状态READING_ROW_FROM_PROBE_item4、否则&#xff0c;向hash map中写入一条row5、如果hash map 写入成功&#xff0c;返回2&#xff0c;继续执行6、…