【问题标题】:Why is my BottomAppBar no longer displaying?为什么我的 BottomAppBar 不再显示?
【发布时间】:2014-12-13 09:06:20
【问题描述】:

我的 BottomAppBar 之前显示过。我没有更改 XAML,即 MainPage.xaml:

<Page.BottomAppBar>
    <AppBar x:Name="bottomAppBar" Padding="10,0,10,0">
        <CommandBar>
            <CommandBar.SecondaryCommands>
                <AppBarButton Icon="BrowsePhotos" Label="Browse" AutomationProperties.Name="Browse Photos" Click="btnOpenImgFiles_Click"/>
            </CommandBar.SecondaryCommands>
            <CommandBar.PrimaryCommands>
                <AppBarButton Icon="OpenFile" Label="Open" AutomationProperties.Name="Open File" Click="btnOpenMap_Click"/>
                <AppBarButton Icon="Save" Label="Save" AutomationProperties.Name="Save File" Click="btnSaveMap_Click"/>
            </CommandBar.PrimaryCommands>
        </CommandBar>
    </AppBar>
</Page.BottomAppBar>

在通过 F5 运行我的(目前非常简约的)应用程序时,我可以通过 Windows 键 + Z 显示 BottomAppBar,但它现在是空白的 - 只是一个黑条。会发生什么?

【问题讨论】:

    标签: visual-studio-2013 windows-store-apps winrt-xaml appbar


    【解决方案1】:

    您不应该将应用栏放在应用栏中。这是你应该拥有的:

    <Page.BottomAppBar>
        <CommandBar x:Name="bottomAppBar">
            <CommandBar.SecondaryCommands>
                <AppBarButton Icon="BrowsePhotos" Label="Browse" AutomationProperties.Name="Browse Photos" Click="btnOpenImgFiles_Click"/>
            </CommandBar.SecondaryCommands>
            <CommandBar.PrimaryCommands>
                <AppBarButton Icon="OpenFile" Label="Open" AutomationProperties.Name="Open File" Click="btnOpenMap_Click"/>
                <AppBarButton Icon="Save" Label="Save" AutomationProperties.Name="Save File" Click="btnSaveMap_Click"/>
            </CommandBar.PrimaryCommands>
        </CommandBar>
    </Page.BottomAppBar>
    

    如果您真的对填充有强烈的感觉,请将其作为按钮的边距,而不是嵌套应用栏。

    【讨论】:

    • 谢谢!不,我没有给出任何关于填充的问题——我的意思是一个问题。我刚刚从其他地方复制了该代码。
    猜你喜欢
    • 2014-07-27
    • 2015-07-03
    • 1970-01-01
    • 1970-01-01
    • 2018-01-17
    • 2012-09-08
    • 2016-11-12
    • 2023-03-16
    • 1970-01-01
    相关资源
    最近更新 更多