【发布时间】:2017-01-25 11:52:31
【问题描述】:
我正在制作一个应用程序,我的第一个 UWP 应用程序,我已经花了几个小时寻找它。我需要命令栏保持纵向模式,而应用程序的所有其余部分都进入横向模式。我需要这样的东西:
And in landscape mode, see the bar didn't moved.
到目前为止,这是我的代码:
<Page.BottomAppBar>
<CommandBar IsSticky="True" Name="cmdBar_ed">
<CommandBar.PrimaryCommands>
<AppBarButton Name="newBtn" Label="" Width="30" Click="newFile">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/test.png"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Name="newBtn1" Label="" Width="30" Click="newFile">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/test.png"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Name="newBtn2" Label="" Width="30" Click="newFile">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/test.png"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Name="newBtn3" Label="" Width="30" Click="newFile">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/test.png"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Name="newBtn4" Label="" Width="30" Click="newFile">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/test.png"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Name="btnTab" Label="" Width="30" Click="insertTab">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/btnIcon/Tab.png"/>
</AppBarButton.Icon>
</AppBarButton>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Name="btn_save" Icon="Save" Label="Save" Click="save"/>
<AppBarButton Name="btn_saveAs" Icon="Save" Label="Save As" Click="saveAs"/>
<AppBarButton Name="btnClose" Icon="Cancel" Label="Close File" Click="close" />
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
另外,另一个奇怪的事情是当屏幕键盘被激活时,这个栏会随之移动以保持在屏幕键盘的顶部,而不是在一个固定的位置。我该如何解决?
【问题讨论】:
-
您确定要开发 UWP 吗?对我来说,这看起来像是一个 Windows Phone 8.1 应用程序,因为在 UWP 应用程序中,AppBar 图标周围没有圆角字形。
-
是的,我确定它是一个 UWP 应用程序,我正在使用我的 Lumia 435(升级到 windows 10 移动版)来运行它。到目前为止,除了这些问题之外,它仍然有效。