What's new in Windows 8.1 Part 1

  • 1010
  • 0

What's new in Windows 8.1 Part 1

接下來幾篇將會跟大家介紹在Windows 8.1 中新增了哪些控制項,還有哪些功能。

首先就是大家寫app應該都會用到的appbar,appbar通常我們會搭配內建的button,以前如果我們要使用內建的button都需要搭配Common底下的StandardStyles.xml而且常常都要自己去把註解拿掉才可以使用,這樣是不是有點不方便呢?但是,Windows 8.1 變得更方便囉。

在Windows 8.1 已經沒有StandardStyles.xml,那我們要如何使用呢?先看看下面這個非常簡單的sample吧

   1:  <Page.BottomAppBar>
   2:    <AppBar>
   3:      <Grid>
   4:        <StackPanel x:Name="RightPanel" Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right">
   5:          <AppBarButton x:Name="BtnLast" Icon="Back" Label="上一張" Click="BtnLast_Click"/>
   6:          <AppBarButton x:Name="BtnNext" Icon="Forward" Label="下一張" Click="BtnNext_Click"/>
   7:          <AppBarSeparator/>
   8:          <AppBarButton x:Name="BtnClean" Icon="Clear" Label="清除" Click="BtnClean_Click" />
   9:          <AppBarToggleButton x:Name="BtnEdit" Icon="Edit" Label="畫筆" Click="BtnEdit_Click_1"/>
  10:        </StackPanel>
  11:      </Grid>
  12:    </AppBar>
  13:  </Page.BottomAppBar>

 

在Windwos 8.1 新的控制項有三種。

第一種是AppBarButton,這就是跟我們之前的button是最像的,但是大家可以發現之前是要寫在StaticResource裡面,現在呢只要你打 Icon 裡面就有非常多的Button任君挑選,而且現在更方便的是,我們可以直接宣告他的Lable就會改變Button底下的文字,超方便的這樣大家就可以發揮自己的創意為自己的Button取個好名字。

 

第二種是AppBarToggleButton,這個其實跟我們AppBarButton是差不多的,唯一的差別就是你點下去之後會反白,反白代表著什麼呢?它可以有兩種不同的狀態,代表著開或是關。可以透過這種按鈕讓使用者知道他現在是在哪個模式底下。他的描述方法跟AppBarButton是一樣的。

 

第三種是AppBarSeparator,這就是分隔線。如果你有很多Button但是他們功能上是屬於不同種類,這時候就可以用分隔線,有效的區隔分類會讓使用者覺得更方便。

最後請大家注意,在Windows 8.1 會自動忽略Content的屬性。

下篇會為大家介紹,Icon還有哪些布一樣的屬性。