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

标签 .net mobile windows-phone-8 windows-phone windows-phone-8.1

在 windows phone 8 中,添加应用栏并对其进行管理非常容易,但现在我测试了新的 windows phone 8.1 SDK 以构建具有新地理围栏功能的项目,但我不知道如何在应用中添加应用栏。

最佳答案

在 Windows Phone 8.1 中,我们可以使用 BottomAppBar添加应用程序栏。通常我们使用 CommandBar创建基本的BottomAppBar。 CommandBar 包含两个集合: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>

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

关于.net - 如何在 Windows Phone 8.1 中添加 AppBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23529527/

相关文章:

.NET Test Harness 它应该有什么

.net - 一个好的 gradle nunit 插件?

c# - 异常: Object synchronization method was called from an unsynchronized block of code

.net - Double 和 Single 的 DependencyProperty 问题

ios - UIScreen Brightness 属性

windows-phone-8 - 如果安装了 WP 8.1 SDK,如何安装 WP 8.0 SDK?

mobile - 显示平板电脑的桌面版本

android - crashlytics 是否有公共(public) API?

c# - 从邮件客户端打开应用程序,Windows Phone 8

windows-phone-7 - Windows Phone ApplicationBar MenuItems空间问题