WPF RotateTransform对偏移量的问题

在下面的:
<Rectangle Height="60" HorizontalAlignment="Left" Margin="50,100,0,0" Name="rectangle2" Stroke="Black" VerticalAlignment="Top" Width="60" >
<Rectangle.RenderTransform>
    <TransformGroup>
        <RotateTransform Angle="45" CenterX="30" CenterY="30"/>
    </TransformGroup>
</Rectangle.RenderTransform>
要在其中心旋转矩形,我必须将CenterX和Y设置为Rectangle大小的一半。有没有办法在标记中做到这一点? 像CenterX =“{Binding Path = Width 2}”之类的东西?     
已邀请:
您可以在
Rectangle
本身设置
RenderTrasformOrigin
属性:
<Rectangle Height="60" HorizontalAlignment="Left" Margin="50,100,0,0" Name="rectangle2" 
           Stroke="Black" VerticalAlignment="Top" Width="60" 
           RenderTrasformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
    <TransformGroup>
        <RotateTransform Angle="45" />
    </TransformGroup>
</Rectangle.RenderTransform>
    

要回复问题请先登录注册