.net – 如何在Windows Phone 8.1中添加AppBar

前端之家收集整理的这篇文章主要介绍了.net – 如何在Windows Phone 8.1中添加AppBar前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在Windows Phone 8中,它很容易添加一个App Bar并进行管理,但是现在我测试了新的Windows Phone 8.1 SDK来构建一个具有新的Geofencing功能的项目,但是我不知道如何在App中添加一个App Bar.
在Windows Phone 8.1中,我们可以使用BottomAppBar添加App Bar.通常我们使用CommandBar创建基本的BottomAppBar. CommandBar包含两个集合:PrimaryCommands和SecondaryCommands,与Windows Phone 8中的Shell:ApplicationBar.Buttons和shell:ApplicationBar.MenuItems类似.

请阅读本演示,我们创建一个带有两个按钮的CommandBar:ZoomOut和ZoomIn,以及两个menuItem:Test01和Test02:

  1. <Page.BottomAppBar>
  2. <CommandBar IsSticky="True" x:Name="appBar">
  3. <CommandBar.PrimaryCommands>
  4. <AppBarButton Icon="ZoomOut" IsCompact="False" Label="ZoomOut"/>
  5. <AppBarButton Icon="ZoomIn" IsCompact="False" Label="ZoomIn"/>
  6. </CommandBar.PrimaryCommands>
  7. <CommandBar.SecondaryCommands>
  8. <AppBarButton Label="Test01"/>
  9. <AppBarButton Label="Test02"/>
  10. </CommandBar.SecondaryCommands>
  11. </CommandBar>
  12. </Page.BottomAppBar>

编辑:现在的代码是正确的!

猜你在找的Windows相关文章