Question

Is there any way to stop a control (or group of them) from rotating when the orientation changes?

I need to not rotate my gameboard, but it would by handy if the rest of screen (other GUI elements like pop up windows etc.) rotates automatically and I wouldn't have to rotate them manually.

I know that I can change orientation of everything and than rotate only the canvas with GameBoard using RotateTransform, but it's kinda hard to find center point of it and rotate it properly.

EDIT: Now i see that if I want automatic orientation changing of some control I'll have rotate my gameboard by myself. So is there any easy way to find centrer point for RotateTransform of a control?

Was it helpful?

Solution

I think you have to do this manually. You're talking Silverlight rather than XNA right? Silverlight will do its best to rotate stuff for you. Simply changing the orientation will cause Silverlight to naturally perform layout again with the new screen dimensions (and device axis flipped).

You will have to perform a manual rotation on the controls if you want them to stay oriented.

This may be useful: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/04/08/automatic-rotation-support-or-automatic-multi-orientation-layout-support-for-windows-phone.aspx

There's a link to a PDF that might also be useful at the bottom of that page. However I fear you will have to manually rotate them.

You could consider locking the orientation too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top