You:
RotateTransform rotation = element.RenderTransform as RotateTransform;
if (rotation != null) // Make sure the transform is actually a RotateTransform
{
double rotationInDegrees = rotation.Angle;
// Do something with the rotationInDegrees here, if needed...
}
sadece başka UIElement olmak için
aynı şekilde döndürmek, sadece aynı dönüşümü atayabilirsiniz RotateTransform'un isim ve sonra özelliklerinde bağlanabilir. Örneğin, 'Ana' ui elemanda, sen dönüştürmek şekilde tanımlayın:
<TextBlock Text="MainBox">
<TextBlock.RenderTransform>
<RotateTransform Angle="20"
CenterX="50"
CenterY="50"
x:Name="m"/>
</TextBlock.RenderTransform>
</TextBlock>
Ardından bu bağlayabilir başka öğeden dönüşümü:
<TextBlock Text="SecondBox">
<TextBlock.RenderTransform>
<RotateTransform Angle="{Binding Angle, ElementName=m}"
CenterX="{Binding CenterX, ElementName=m}"
CenterY="{Binding CenterY, ElementName=m}"/>
</TextBlock.RenderTransform>
</TextBlock>