gpt4 book ai didi

c# - 在我们有 PageOrientation LandscapeRight/LandscapeLeft 之前如何知道页面的方向?

转载 作者:行者123 更新时间:2023-11-30 21:58:00 25 4
gpt4 key购买 nike

在 Windows Phone 8.0 中,我们有 PageOrientationLandscapeLeftLandscapeRight 等等。现在,我们只有 ApplicationView.GetForCurrentView().OrientationDisplayProperties.CurrentOrientation,但这两个都只能告诉我我的页面是否是Horizo​​ntal垂直。有谁知道如何重现我们在 Windows Phone 8 中的 LandscapeLeftLandscapeRight

当用户旋转我的应用程序页面时(Windows Phone 8.1 XAML)我需要知道他是否旋转了应用程序ClockwiseCounterClockwise 谁知道如何我能做到吗?

最佳答案

看了之后我想我可能找到了解决方案,但它可能不是最好的解决方案:

使用

 DisplayProperties.OrientationChanged += Page_OrientationChanged;

我们能够看到页面何时旋转,然后在这个方法中,我们使用 DisplayProperties.CurrentOrientation 获得新的方向:

 private void Page_OrientationChanged(object sender)
{
DisplayOrientations orientation = DisplayProperties.CurrentOrientation;

switch (orientation )
{
case DisplayOrientations.Landscape:
bla();
break;
case DisplayOrientations.LandscapeFlipped:
blabla();
break;
case DisplayOrientations.Portrait:
MoreBla();
break;
case DisplayOrientations.PortraitFlipped:
MoreBlaBla();
break;
}
}

在这里我们可以知道页面是否已旋转为 Landscape、LandscapeFlipped、Portrait 和/或 PortraitFlipped。

关于c# - 在我们有 PageOrientation LandscapeRight/LandscapeLeft 之前如何知道页面的方向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30337472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com