Question

I'm making a simple WP7 game and I have a little problem with orientation changing. My gameboard looks like this:

enter image description here

And I need to rotate only the numbers when orientation changed. Is there any easy way to do it? The numbers are TextBlocks and lines are rectangles. Gameboard is Canvas (but I can use Grid as well).

Or i could exclude the canvas from automatic rotating and only redraw the numbers. But I don't know how to do it either.

Was it helpful?

Solution

Using PlaneProjection should be fine:

<TextBlock.Projection>
  <PlaneProjection RotationZ="90"/>
</TextBlock.Projection>

Obviously this would apply the projection immediately, so you would need to create it in code (or try using 0 for the Z value and then changing that in code (possibility of this is a long shot)) based on the data provided (and within) the OrienationChanged event handler, such as:

myTextBlock.Projection = new PlaneProjection { RotationZ = 90 };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top