WP7(Windows Phone 7的)在XAML中或C#锁闭手机定位 [英] WP7 (Windows phone 7) Lock phone orientation in XAML or C#

查看:161
本文介绍了WP7(Windows Phone 7的)在XAML中或C#锁闭手机定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能manualy锁定的Windows Phone 7手机的方向?
,因为我使用加速度计来处理按钮的转动一个固定的UI

Is it possible to manualy lock the phone orientation in Windows phone 7 ? Because I'm using the accelerometer to handle buttons' rotation with a fixed UI.

我已经试过了:

在XAML

SupportedOrientations="Landscape" Orientation="LandscapeLeft"
OrientationChanged="PhoneApplicationPage_OrientationChanged"

而在后面的代码:

private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
    //Orientation locking
    //Do nothing
}

不过,UI仍然之间进行切换的景观离开的和的景观权 ...

But the UI is still shifting between landscape left and landscape right...

感谢。

推荐答案

有没有办法阻止LandscapeLeft和LandScapeRight之间的转换。这是由设计。

There is no way to prevent the shifting between LandscapeLeft and LandScapeRight. This is by design.

作为变通,你可以手动旋转/变换在OnOrientationChanged你的UI元素,使用户看不到的差异。结果
我已经使用这种技术来出现,无论方向旋转,但其随后出现就像一个弹出但不应对方向改变显示在图像的顶部一个独立的控制保持一个背景的形象。

As a work around, you can manually rotate/transform your UIElements in the OnOrientationChanged so that the user doesn't see a difference.
I've used this technique to keep a "background" image from appearing to rotate regardless of orientation but then having a separate control which appears like a popup but which does respond to orientation changes show on top of the image.

这篇关于WP7(Windows Phone 7的)在XAML中或C#锁闭手机定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆