如何在Windows Phone 8.1中添加AppBar [英] How can i add AppBar in Windows Phone 8.1
问题描述
在Windows Phone 8中,非常容易添加和管理应用程序栏,但是现在我测试新的Windows Phone 8.1 SDK来构建具有新地理围栏功能的项目,但是我不知道如何在其中添加应用程序栏该应用程序.
In windows phone 8, its very easy to add an App Bar and manage it, but now i test new windows phone 8.1 SDK to build a project with new Geofencing feature but i don't know how to add an App Bar in the App.
推荐答案
在Windows Phone 8.1中,我们可以使用BottomAppBar
添加应用栏.通常,我们使用CommandBar
创建基本的BottomAppBar. CommandBar包含两个集合:PrimaryCommands
和SecondaryCommands
,与Windows Phone 8中的shell:ApplicationBar.Buttons
和shell:ApplicationBar.MenuItems
相似.
In Windows Phone 8.1, We can use BottomAppBar
to add App Bar. Usually we use CommandBar
to create basic BottomAppBar. CommandBar contains two collection: PrimaryCommands
and SecondaryCommands
, It's similar with shell:ApplicationBar.Buttons
and shell:ApplicationBar.MenuItems
in Windows Phone 8.
请阅读此演示,我们创建一个带有两个按钮的CommandBar:ZoomOut和ZoomIn,以及两个menuItem:Test01和Test02:
Read this demo please, we create a CommandBar with two buttons: ZoomOut and ZoomIn, and two menuItem:Test01 and Test02 :
<Page.BottomAppBar>
<CommandBar IsSticky="True" x:Name="appBar">
<CommandBar.PrimaryCommands>
<AppBarButton Icon="ZoomOut" IsCompact="False" Label="ZoomOut"/>
<AppBarButton Icon="ZoomIn" IsCompact="False" Label="ZoomIn"/>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Label="Test01"/>
<AppBarButton Label="Test02"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
现在代码正确了!
这篇关于如何在Windows Phone 8.1中添加AppBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!