Silverlight 中的锁定屏幕方向
我正在使用浏览器外的 Silverlight 纵向开发平板电脑上的应用程序。
然而,当平板电脑转向横向模式时,应用程序也会转动,并且所有对齐方式都会被打乱。 我发现一篇文章(http://stackoverflow.com/questions/8323318/wpf-orientation)提供了WPF的解决方案,但Microsoft.Win32.SystemEvents命名空间在Silverlight中不可用。
那么有什么方法可以将我的 Siverlight OOB 应用程序锁定到单一方向吗?
谢谢你!
I'm developing an application on a tablet using Silverlight out-of-browser with portrait orientation.
However, when the tablet is turned to landscape mode, the application also turns, and all the alignments are thrown off.
I found a post (http://stackoverflow.com/questions/8323318/wpf-orientation) that provides the solution for WPF, but the Microsoft.Win32.SystemEvents namespace is not available in Silverlight.
So is there any way I can lock my Siverlight OOB application to a single orientation?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 WPF 中,您可以为根容器提供旋转布局转换。它实际上并不是锁定方向,而是旋转您的应用程序。据我所知,在 Silverlight 中,仅支持渲染转换,如果没有其他不利影响,这将很难做到。
我不知道有任何公共 API 可以锁定屏幕方向。主要是因为,平板电脑制造商通常提供自己的预装实用程序或驱动程序,使用加速度计数据来改变方向。它不是内置的操作系统功能。这在 Windows 8 中可能会发生变化。
In WPF you could provide a rotation layout transformation to the root container. It isn't actually locking the orientation but rather rotating your application. In Silverlight which as far as I know only supports render transformation, this would be much more difficult to do without other adverse effects.
I'm not aware of any public API to lock the screen orientation. Mostly because typically, Tablet PC manufacturers provided their own preinstalled utilities or drivers that used accelerometer data to change orientation. It was not a built in OS function. This may be changing in Windows 8.