2

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!

Slobo80
  • 186
  • 7
  • I will suggest design your UI that uses fluent layout like what they said in this post http://stackoverflow.com/questions/8323318/wpf-orientation and is not a good thing to not letting user to not use the orientation they want to use unless there is meaningful reason.... – King Chan Jan 06 '12 at 17:21
  • Unfortunately it is too late to change the design. We will have to address that in the next iteration. – Slobo80 Jan 10 '12 at 12:54

1 Answers1

0

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.

Josh
  • 68,005
  • 14
  • 144
  • 156
  • I ended up disabling the accelerometer on the device as a temporary workaround. We will probably have to redesign the UI to use fluent layout. – Slobo80 Jan 10 '12 at 12:55