[英]WP8.1 commandbar (appbar) issticky issue
I would like to create a commandbar (former appbar) that is not getting closed when the user presses one of the primary command buttons. 我想创建一个在用户按下主要命令按钮之一时不会关闭的命令栏(以前的应用栏)。 When i got it right, the "issticky"-property should make this behavior possible. 当我做对的时候,“粘滞”特性应该使这种行为成为可能。
My XAML Code: 我的XAML代码:
<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 doesn't work, i also tested to set it in the button tapped event handler. IsSticky = true不起作用,我还测试了在按钮点击事件处理程序中对其进行设置。
What is the regular way of getting this behavior? 获得此行为的常规方法是什么? Or does anyone know a 'workaround'? 还是有人知道“解决方法”?
I would be grateful for any suggestions! 如有任何建议,我将不胜感激!
Best, 最好,
Change the ClosedDisplayMode to Compact or remove it from the CommandBar definition (it's the default). 将ClosedDisplayMode更改为Compact或将其从CommandBar定义中删除(这是默认设置)。
<CommandBar x:Name="bottomCommandBar" ClosedDisplayMode="Compact">
or 要么
<CommandBar x:Name="bottomCommandBar">
在页面加载中尝试一下
((AppBar)bottomCommandBar).IsSticky = true;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.