This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page.BottomAppBar> | |
<CommandBar> | |
<CommandBar.PrimaryCommands> | |
<AppBarButton Label="Emoji2" Icon="Emoji2"/> | |
</CommandBar.PrimaryCommands> | |
<CommandBar.SecondaryCommands> | |
<AppBarButton Label="Like" Icon="Like"/> | |
</CommandBar.SecondaryCommands> | |
</CommandBar> | |
</Page.BottomAppBar> |
PrimaryCommands與SecondaryCommands
在Windows 8.1之後的AppBar多了CommandBar的用法,而CommandBar中還可以再分PrimaryCommands與SecondaryCommands,兩者主要差別是PrimaryCommands中的Button會出現在右邊而SecondaryCommands則會出現在左邊如下圖但在Windows Phone 8.1中就不是左右的差別了,畢竟手機螢幕不大還分左右也蠻奇怪,PrimaryCommands中的Button在WP8.1就是一般正常的AppBar Button,相當於之前的ApplicationBarIconButton,但SecondaryCommands中的Button則會變成MenuItem而非Button(就像下圖),相當於之前的ApplicationBarMenuItem
ClosedDisplayMode
在Windows Phone 8.1中的CommandBar額外多了一種ClosedDisplayMode屬性,這是Windows 8.1沒有的,這屬性其實就像過去的ApplicationBar中的Mode屬性,可以控制AppBar是否要隱藏到最小或是正常顯示,如果要隱藏到最小設定成Minimal就可以(如下圖),預設則為Compact<CommandBar ClosedDisplayMode="Minimal">
<CommandBar ClosedDisplayMode="Compact">
TopAppBar
在Windows Phone 8.1只能用BottomAppBar,TopAppBar是只有Windows 8才有的,因為在手機中如果上下都有功能表感覺也很怪XD這篇主要分享一下在Windows Phone 8.1 (Windows Runtime)中的AppBar與Windows 8.1的差異,但如果Windows Phone 8.1 是用Windows Phone Silverlight來開發的話,那AppBar就跟過去的作法是一樣沒變的
0 意見:
張貼留言