简体   繁体   English

C#WinRT Windows Phone 8.1-导航栏可见时,应用栏覆盖弹出菜单

[英]C# WinRT Windows Phone 8.1 - App Bar Covers Flyout Menu When Nav Bar Is Visible

I have a Windows Phone 8.1 app that uses a bottom app bar. 我有一个使用底部应用程序栏的Windows Phone 8.1应用程序。 The bottom app bar opens a menu flyout when one of the app bar buttons is clicked. 单击应用程序栏按钮之一时,底部的应用程序栏将打开菜单弹出窗口。 When the flyout menu is opened, the bottom of it is partially covered by the app bar. 打开弹出菜单时,其底部部分被应用程序栏覆盖。 This only occurs when the virtual nav bar is visible. 仅当虚拟导航栏可见时才会发生这种情况。 If the virtual nav bar is hidden, or the phone has physical navigation buttons, then the flyout menu displays properly in it's entirety. 如果虚拟导航栏处于隐藏状态,或者电话具有物理导航按钮,则弹出菜单将正确显示。

I researched this thoroughly and it's not a duplicate. 我对此进行了详尽的研究,但这并不是重复的。

A similar question is Flyout behind Appbar . 类似的问题是Appbar后面的Flyout I tried hiding the bottom app bar when the flyout menu is shown, but then the flyout menu is just hidden behind the virtual nav bar. 显示弹出菜单时,我尝试隐藏底部的应用栏,但是弹出菜单仅隐藏在虚拟导航栏的后面。

Another similar question is AppBarButton.Flyout bad positioning . 另一个类似的问题是AppBarButton.Flyout定位错误 I tried creating the flyout menu programmatically, but the flyout menu was still obscured. 我尝试以编程方式创建弹出菜单,但是弹出菜单仍然被遮盖。

I tried creating a new app with only the bottom app bar, an app bar button and a menu flyout, with the same results. 我尝试仅使用底部应用程序栏,应用程序栏按钮和菜单弹出按钮来创建新应用程序,结果相同。 I tested it in the emulator with physical navigation buttons, in the emulator with the virtual nav bar and on my physical device with the virtual nav bar. 我在带有物理导航按钮的模拟器中,在带有虚拟导航栏的模拟器中以及在带有虚拟导航栏的物理设备上对它进行了测试。

Please note that to test this in the emulator with the virtual nav bar buttons you have to set it to the 720P or 1080P emulator and then click Tools, Sensors, enable Software Buttons, click Apply and then wait for the OS to restart. 请注意,要使用虚拟导航栏按钮在模拟器中进行测试,必须将其设置为720P或1080P模拟器,然后依次单击工具,传感器,启用软件按钮,单击应用,然后等待操作系统重新启动。

I tried adding an extra blank menu flyout item at the bottom of the menu flyout to compensate for space at the bottom, but that is not desirable when the virtual nav bar is hidden, because then there is an empty space visible. 我尝试在菜单弹出窗口的底部添加一个额外的空白菜单弹出菜单项,以补偿底部的空间,但是当虚拟导航栏被隐藏时,这是不希望的,因为这样可以看到一个空白空间。 The same goes for adding a bottom margin to the last menu flyout item. 将底部边距添加到最后一个菜单弹出项目也是如此。

I also tried experimenting with ApplicationViewBoundsMode.UseVisible and ApplicationViewBoundsMode.UseCoreWindow and hiding or showing the bottom app bar without getting any consistent results. 我还尝试使用ApplicationViewBoundsMode.UseVisible和ApplicationViewBoundsMode.UseCoreWindow进行实验,并隐藏或显示底部的应用栏,而没有得到任何一致的结果。

This seems like a bug but there must be a reasonable solution since using the Calendar app and clicking the view button to select day, week, month or year seems to work perfectly regardless of whether the virtual nav bar is visible or hidden or the phone doesn't use the virtual nav bar at all. 这似乎是一个错误,但是必须有一个合理的解决方案,因为使用日历应用程序并单击查看按钮以选择日,周,月或年似乎可以完美地工作,而不管虚拟导航栏是可见的还是隐藏的,或者电话没有根本不使用虚拟导航栏。

I would like to have the menu flyout not covered by the bottom app bar. 我希望菜单弹出不会被底部的应用程序栏所覆盖。 How can this be achieved? 如何做到这一点?

Did you try PopUpMenu class? 您尝试过PopUpMenu类吗? This class gives u almost the same experience as Flyout Menu does, unless it doesn't pop up the element it's shown on and can be easily shown in any position. 此类给您几乎与“弹出菜单”相同的体验,除非它不会弹出显示在其上的元素并且可以在任何位置轻松显示。 I guess your problem may be solved by using it. 我想您的问题可以通过使用它解决。

Here's the documentation for it https://msdn.microsoft.com/library/windows/apps/br208693 这是它的文档https://msdn.microsoft.com/library/windows/apps/br208693

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM