为什么AppBar在windows surface pro 1和windows surface pro 4中的行为有所不同?

时间:2016-10-07 22:57:56

标签: c# wpf windows-store-apps pixelsense appbar

我的应用栏定义如下:

<AppBar x:Name="MyBottomBar" IsSticky="True" IsOpen="True" Closed="MyBottomBar_Closed" SizeChanged="MyBottomBar_SizeChanged">

private void MyBottomBar_Closed(object sender, object e)
{
  if (!this.BottomAppBar.IsOpen && KeepBottomAppBarOpen)
  {
      this.BottomAppBar.IsOpen = true;
  }
}

然后我在应用栏的同一页面的顶部有一个TextBox,一旦我开始输入文本框,就会显示软键盘。我有一些工作流程将KeepBottomAppBarOpen设置为true。但是当我在文本框中输入时,KeepBottomAppBarOpen为false。在Surface pro 1中,一旦我开始输入文本框,软键盘就会显示,应用程序栏会跳到软键盘上方。但是在Surface pro 4中,一旦我开始输入文本框,软键盘就会显示,并且应用栏不会跳转,因为它位于页面的底部,软键盘会隐藏它。

这是否由于Surface pro 1和surface pro 4之间的差异而设计? 我该怎么办才能让应用栏跳到表面专业版1的软键盘上方?

添加屏幕。 Surface Pro 1: enter image description here

Surface Pro 4: enter image description here

1 个答案:

答案 0 :(得分:1)

我个人认为这是设计上的。 如果您不希望条形跳过软键盘,您可以参考艾米在this thread中所说的内容。

当我们点击TextBox时,BottomAppBar将停留在屏幕键盘的顶部,解决方案是将AppBar放入Grid而不是BottonAppBar。

<Grid>
    <AppBarButton VerticalAlignment="Bottom">
       <TextBox Text="AppBar"/>
    </AppBarButton>
    <TextBox VerticalAlignment="Center" Text="Hola"/>
</Grid>

我测试了它,它运行正常。希望它会有所帮助。

相关问题