PlaneProjection Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Represents a perspective transform (a 3-D-like effect) on an object.
Inheritance Hierarchy
System.Object
System.Windows.DependencyObject
System.Windows.Media.Projection
System.Windows.Media.PlaneProjection
Namespace: System.Windows.Media
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public NotInheritable Class PlaneProjection _
Inherits Projection
public sealed class PlaneProjection : Projection
<PlaneProjection .../>
The PlaneProjection type exposes the following members.
Constructors
Name | Description | |
---|---|---|
PlaneProjection | Initializes a new instance of the PlaneProjection class. |
Top
Properties
Name | Description | |
---|---|---|
CenterOfRotationX | Gets or sets the x-coordinate of the center of rotation of the object you rotate. | |
CenterOfRotationY | Gets or sets the y-coordinate of the center of rotation of the object you rotate. | |
CenterOfRotationZ | Gets or sets the z-coordinate of the center of rotation of the object you rotate. | |
Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) | |
GlobalOffsetX | Gets or sets the distance the object is translated along the x-axis of the screen. | |
GlobalOffsetY | Gets or sets the distance the object is translated along the y-axis of the screen. | |
GlobalOffsetZ | Gets or sets the distance the object is translated along the z-axis of the screen. | |
LocalOffsetX | Gets or sets the distance the object is translated along the x-axis of the plane of the object. | |
LocalOffsetY | Gets or sets the distance the object is translated along the y-axis of the plane of the object. | |
LocalOffsetZ | Gets or sets the distance the object is translated along the z-axis of the plane of the object. | |
ProjectionMatrix | Gets the projection matrix on the PlaneProjection. | |
RotationX | Gets or sets the number of degrees to rotate the object around the x-axis of rotation. | |
RotationY | Gets or sets the number of degrees to rotate the object around the y-axis of rotation. | |
RotationZ | Gets or sets the number of degrees to rotate the object around the z-axis of rotation. |
Top
Methods
Name | Description | |
---|---|---|
CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) | |
ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetAnimationBaseValue | Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) | |
SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Fields
Name | Description | |
---|---|---|
CenterOfRotationXProperty | Identifies the CenterOfRotationX dependency property. | |
CenterOfRotationYProperty | Identifies the CenterOfRotationY dependency property. | |
CenterOfRotationZProperty | Identifies the CenterOfRotationZ dependency property. | |
GlobalOffsetXProperty | Identifies the GlobalOffsetX dependency property. | |
GlobalOffsetYProperty | Identifies the GlobalOffsetY dependency property. | |
GlobalOffsetZProperty | Identifies the GlobalOffsetZ dependency property. | |
LocalOffsetXProperty | Identifies the LocalOffsetX dependency property. | |
LocalOffsetYProperty | Identifies the LocalOffsetY dependency property. | |
LocalOffsetZProperty | Identifies the LocalOffsetZ dependency property. | |
ProjectionMatrixProperty | Identifies the ProjectionMatrix dependency property. | |
RotationXProperty | Identifies the RotationX dependency property. | |
RotationYProperty | Identifies the RotationY dependency property. | |
RotationZProperty | Identifies the RotationZ dependency property. |
Top
Remarks
This class is used to create a perspective transform (a 3-D effect) on an object. For example, you can create the illusion that an object is rotated toward or away from you.
Image with perspective transform
Although the preceding illustration shows a perspective transform applied to a simple image, you can apply one to any UIElement, including controls. For example, you could apply the effect to a Grid that in turn contains a TextBox and Button. Despite the controls being rotated, the user could type into the TextBox and click the Button (assuming the controls are visible).
Another common scenario for using perspective transforms is to arrange objects in relation to one another to create a 3-D effect, as shown in the following illustration.
Stacking objects to create a 3-D effect
Besides creating static 3-D effects, you can animate the perspective transform properties to create moving 3-D effects.
PlaneProjection has 12 properties you can use to control the rotation and positioning of an object: RotationX, RotationY, RotationZ, CenterOfRotationX, CenterOfRotationY, CenterOfRotationZ, GlobalOffsetX, GlobalOffsetY, GlobalOffsetZ, LocalOffsetX, LocalOffsetY, and LocalOffsetZ. The following sample allows you to experiment with these properties.
Note: |
---|
Perspective transforms are not equivalent to a 3-D engine, however, they can be used to make 2-D Silverlight content appear as if it is drawn on a 3-D plane. |
Examples
To apply a perspective transform to a UIElement, set the UIElement object's Projection property to a PlaneProjection. The PlaneProjection defines how the transform is rendered in space. The following example shows a simple case.
<StackPanel Margin="35" Background="Gray">
<StackPanel.Projection>
<PlaneProjection RotationX="-35" RotationY="-35" RotationZ="15" />
</StackPanel.Projection>
<TextBlock Margin="10">Type Something Below</TextBlock>
<TextBox Margin="10"></TextBox>
<Button Margin="10" Content="Click" Width="100" />
</StackPanel>
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.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also