手把手玩轉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.pswp.cn/news/377037.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377037.shtml
英文地址,請注明出處:http://en.pswp.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、…