WP8.1命令栏(appbar)粘滞问题

本文关键字:问题 appbar 命令 WP8 | 更新日期: 2023-09-27 18:12:45

我想创建一个命令栏(以前的appbar),当用户按下一个主要命令按钮时,它不会关闭。如果我设置对了,"issticky"-属性应该会使这个行为成为可能。

My XAML Code:

<Page.BottomAppBar>
    <CommandBar x:Name="bottomCommandBar" IsSticky="True" ClosedDisplayMode="Minimal">
        <CommandBar.PrimaryCommands>
            <AppBarButton x:Name="button1" Label="Button1" Tapped="Button1_Tapped">
                <AppBarButton.Icon>
                    <PathIcon Data=""/>
                </AppBarButton.Icon>
            </AppBarButton>
            <AppBarButton x:Name="button2" Label="Button2" Tapped="Button2_Tapped">
                <AppBarButton.Icon>
                    <PathIcon Data=""/>
                </AppBarButton.Icon>
            </AppBarButton>
        </CommandBar.PrimaryCommands>
    </CommandBar>
</Page.BottomAppBar>

IsSticky = true不起作用,我还测试了在按钮点击事件处理程序中设置它。

获得这种行为的常规方式是什么?或者有人知道"变通办法"吗?
如有任何建议,我将不胜感激!
,

WP8.1命令栏(appbar)粘滞问题

将ClosedDisplayMode更改为Compact或将其从CommandBar定义中删除(这是默认值)

<CommandBar x:Name="bottomCommandBar" ClosedDisplayMode="Compact">

<CommandBar x:Name="bottomCommandBar">

尝试在您的页面加载

((AppBar)bottomCommandBar).IsSticky = true;