如何在Windows Phone 8.1中添加AppBar

15 .net mobile windows-phone windows-phone-8 windows-phone-8.1

在Windows Phone 8中,它很容易添加App Bar并对其进行管理,但现在我测试新的Windows Phone 8.1 SDK以构建具有新Geofencing功能的项目,但我不知道如何在App中添加App Bar.

Chr*_*hao 43

在Windows Phone 8.1中,我们可以使用BottomAppBar添加App Bar.通常我们CommandBar用来创建基本的BottomAppBar.命令栏包含两个集合:PrimaryCommandsSecondaryCommands,这是一个与类似shell:ApplicationBar.Buttonsshell:ApplicationBar.MenuItems在Windows Phone 8的.

请阅读此演示,我们创建一个带有两个按钮的CommandBar:ZoomOut和ZoomIn,以及两个menuItem:Test01和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>
Run Code Online (Sandbox Code Playgroud)

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