如何向控件添加多个转换?

时间:2013-04-16 19:12:20

标签: c# windows-phone-7

我想缩放它并旋转它。但我的控制只需要进行一次转换.RenderTransform

如何添加ScaleTransform和Rotatetransform?

1 个答案:

答案 0 :(得分:3)

这是从MSDN

开始的
<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  <StackPanel Margin="50">

      <Button 
        RenderTransformOrigin="0.5,0.5"
        HorizontalAlignment="Center">Click
        <Button.RenderTransform>

          <!-- TransformGroup enables you to apply multiple transforms. In 
               this example, the button is scaled and rotated. -->
          <TransformGroup>

            <!-- Triple the size (scale) of the button in the Y direction. -->
            <ScaleTransform ScaleY="3" />

            <!-- Rotate the button by 45 degrees. -->
            <RotateTransform Angle="45" />

          </TransformGroup>
        </Button.RenderTransform>
      </Button>

  </StackPanel>
</Page>
相关问题