다음을 통해 공유


PlaneProjection.CenterOfRotationZ Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the z-coordinate of the center of rotation of the object you rotate.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property CenterOfRotationZ As Double
public double CenterOfRotationZ { get; set; }
<PlaneProjection CenterOfRotationZ="double"/>

Property Value

Type: System.Double
The z-coordinate of the center of rotation of the object you rotate. The default is 0. Values greater than 0 correspond to coordinates out from the plane of the object, and negative values correspond to coordinates behind the plane of the object.

Remarks

Dependency property identifier field: CenterOfRotationZProperty

You can move the center of rotation by using the CenterOfRotationX, CenterOfRotationY, and CenterOfRotationZ propertiesBy default, the axes of rotation run directly through the center of the object, causing the object to rotate around its center; however, if you move the center of rotation to the outer edge of the object, it will rotate around that edge. The default values for CenterOfRotationX and CenterOfRotationY are 0.5, and the default value for CenterOfRotationZ is 0. For CenterOfRotationX and CenterOfRotationY, values between 0 and 1 set the pivot line at some location within the object. A value of 0 denotes one object edge and 1 denotes the opposite edge. Values outside of this range are allowed and will move the center of rotation accordingly. Because the z-axis of the center of rotation is drawn through the plane of the object, you can move the center of rotation behind the object using a negative number and above the object (toward you) using a positive number.

CenterOfRotationX moves the center of rotation along the x-axis parallel to the object while CenterOfRotationY moves the center or rotation along the y-axis of the object. The following illustrations demonstrate examples of using different values for CenterOfRotationY.

CenterOfRotationY = "0.5" (default)

Rotate around X-axis

CenterOfRotationY = "0.1" (upper edge)

CenterOfRotationY value of 0.1.

Notice how the image rotates around the center when the CenterOfRotationY property is set to the default value of 0.5 and rotates near the upper edge when set to 0.1. You see similar behavior when changing the CenterOfRotationX property to move where the RotationY property rotates the object.

CenterOfRotationX = "0.5" (default)

Rotate around the Y-axis.

CenterOfRotationX = "0.9" (right-hand edge)

CenterOfRotationX value of 0.9.

The following example allows you to experiment with rotating the object around different locations for the center of rotation.

Run this sample

You use the CenterOfRotationZ to place the center of rotation above or below the plane of the object. This allows you to rotate the object around the point like a planet orbits around a star.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.