2010-04-05 16 views

Respuesta

15

Usted puede obtener el valor de rotación haciendo:

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... 
} 

Si desea simplemente hacer otra UIElement giran en la misma forma, sólo puede asignar el mismo transform:

element2.RenderTransform = element.RenderTransform; 
3

Usted puede nombrar a RotateTransform y luego enlazar a sus propiedades. Por ejemplo, en el elemento 'principal' ui, se define la transformación de modo que:

<TextBlock Text="MainBox"> 
    <TextBlock.RenderTransform> 
    <RotateTransform Angle="20" 
        CenterX="50" 
        CenterY="50" 
        x:Name="m"/> 
    </TextBlock.RenderTransform> 
</TextBlock> 

A continuación, puede unirse a esa transformar de otro elemento:

<TextBlock Text="SecondBox"> 
    <TextBlock.RenderTransform> 
    <RotateTransform Angle="{Binding Angle, ElementName=m}" 
        CenterX="{Binding CenterX, ElementName=m}" 
        CenterY="{Binding CenterY, ElementName=m}"/> 
    </TextBlock.RenderTransform> 
</TextBlock> 
Cuestiones relacionadas