0

I am creating an app for the Microsoft Surface. I have a WPF control rotated 180 degrees using rendertransform so that people on the other side can use it. There are two of them, one rotated, one not. When a user selects a tab on the control, the control grows to accommodate the tab size. On the one that's not rotated, the height animation works correctly, growing "upward" toward the "top" of the screen. The rotated one grows in the same direction, toward the top as well, but it need to grow on the opposite direction. Both should grow towards the center of the screen.

Setup (They are legends on a map):

<SurfaceWindow>
   <Canvas>
      <UserControl />
      <UserControl /> // rotated
      <Map />
   </Canvas>
</SurfaceWindow>

Is there a way to control the direction of a height animation?

Thanks, Andrew

Andrew Madonna
  • 155
  • 5
  • 12

2 Answers2

0

You don't need two controls : just one with, say, a 'Flipped' property (or a dependency property to use it in design time). When Flipped is True, you should set the rotation on your control and the VerticalAlignment to Top. when false, no rotation and VerticalAlignment to Bottom.

GameAlchemist
  • 18,995
  • 7
  • 36
  • 59
  • There are not two separatly coded controls, just one displayed twice. What should have the VerticalAlignment? The UserControl itself? – Andrew Madonna May 08 '12 at 21:40
  • i would rather use a Grid to structure your window than a canvas. By setting the width/height of each Column/Row to the right fixed size , auto size ("Auto") or star size ("1*"), you can get a result which will be both nice looking and much more maintenable. And yes, you can set the VerticalAlignment in the Controls to test fast, ... or use something like a flipped property... i wouldn't be surprised some other properties of the control will change when it is flipped. – GameAlchemist May 08 '12 at 22:20
0

Solved.

Used LayoutTransform instead of RenderTransform

eg

Legend2.LayoutTransform = new RotateTransform(180);

instead of

Legend2.RenderTransform = new RotateTransform(180);
Andrew Madonna
  • 155
  • 5
  • 12