在我们有 PageOrientation LandscapeRight/LandscapeLeft 之前如何知道页面的方向?
How to know the Orientation of a Page before we had PageOrientation LandscapeRight/LandscapeLeft?
在 Windows Phone 8.0 中,我们有 PageOrientation
和 LandscapeLeft
、LandscapeRight
等等。现在,我们只有 ApplicationView.GetForCurrentView().Orientation
和 DisplayProperties.CurrentOrientation
,但这两个都只告诉我我的页面是 Horizontal
还是 Vertical
。有谁知道如何重现我们在 Windows Phone 8 中的 LandscapeLeft
和 LandscapeRight
?
当用户旋转我的应用页面时(Windows Phone 8.1 XAML) 我需要知道他是否旋转了应用Clockwise
或CounterClockwise
谁知道我该怎么做?
看了之后我想我可能找到了解决方案,但它可能不是最好的解决方案:
正在使用
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;
}
}
在这里我们可以知道页面是否旋转为横向、横向翻转、纵向和/或纵向翻转。
在 Windows Phone 8.0 中,我们有 PageOrientation
和 LandscapeLeft
、LandscapeRight
等等。现在,我们只有 ApplicationView.GetForCurrentView().Orientation
和 DisplayProperties.CurrentOrientation
,但这两个都只告诉我我的页面是 Horizontal
还是 Vertical
。有谁知道如何重现我们在 Windows Phone 8 中的 LandscapeLeft
和 LandscapeRight
?
当用户旋转我的应用页面时(Windows Phone 8.1 XAML) 我需要知道他是否旋转了应用Clockwise
或CounterClockwise
谁知道我该怎么做?
看了之后我想我可能找到了解决方案,但它可能不是最好的解决方案:
正在使用
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;
}
}
在这里我们可以知道页面是否旋转为横向、横向翻转、纵向和/或纵向翻转。