共用方式為


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
Public methodSupported by Silverlight for Windows Phone PlaneProjection Initializes a new instance of the PlaneProjection class.

Top

Properties

  Name Description
Public propertySupported by Silverlight for Windows Phone CenterOfRotationX Gets or sets the x-coordinate of the center of rotation of the object you rotate.
Public propertySupported by Silverlight for Windows Phone CenterOfRotationY Gets or sets the y-coordinate of the center of rotation of the object you rotate.
Public propertySupported by Silverlight for Windows Phone CenterOfRotationZ Gets or sets the z-coordinate of the center of rotation of the object you rotate.
Public propertySupported by Silverlight for Windows Phone Dispatcher Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertySupported by Silverlight for Windows Phone GlobalOffsetX Gets or sets the distance the object is translated along the x-axis of the screen.
Public propertySupported by Silverlight for Windows Phone GlobalOffsetY Gets or sets the distance the object is translated along the y-axis of the screen.
Public propertySupported by Silverlight for Windows Phone GlobalOffsetZ Gets or sets the distance the object is translated along the z-axis of the screen.
Public propertySupported by Silverlight for Windows Phone LocalOffsetX Gets or sets the distance the object is translated along the x-axis of the plane of the object.
Public propertySupported by Silverlight for Windows Phone LocalOffsetY Gets or sets the distance the object is translated along the y-axis of the plane of the object.
Public propertySupported by Silverlight for Windows Phone LocalOffsetZ Gets or sets the distance the object is translated along the z-axis of the plane of the object.
Public propertySupported by Silverlight for Windows Phone ProjectionMatrix Gets the projection matrix on the PlaneProjection.
Public propertySupported by Silverlight for Windows Phone RotationX Gets or sets the number of degrees to rotate the object around the x-axis of rotation.
Public propertySupported by Silverlight for Windows Phone RotationY Gets or sets the number of degrees to rotate the object around the y-axis of rotation.
Public propertySupported by Silverlight for Windows Phone RotationZ Gets or sets the number of degrees to rotate the object around the z-axis of rotation.

Top

Methods

  Name Description
Public methodSupported by Silverlight for Windows Phone CheckAccess Determines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows Phone 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.)
Public methodSupported by Silverlight for Windows Phone 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.)
Public methodSupported by Silverlight for Windows Phone GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetType Gets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodSupported by Silverlight for Windows Phone MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows Phone ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows Phone ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Public fieldStatic memberSupported by Silverlight for Windows Phone CenterOfRotationXProperty Identifies the CenterOfRotationX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone CenterOfRotationYProperty Identifies the CenterOfRotationY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone CenterOfRotationZProperty Identifies the CenterOfRotationZ dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone GlobalOffsetXProperty Identifies the GlobalOffsetX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone GlobalOffsetYProperty Identifies the GlobalOffsetY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone GlobalOffsetZProperty Identifies the GlobalOffsetZ dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone LocalOffsetXProperty Identifies the LocalOffsetX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone LocalOffsetYProperty Identifies the LocalOffsetY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone LocalOffsetZProperty Identifies the LocalOffsetZ dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone ProjectionMatrixProperty Identifies the ProjectionMatrix dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone RotationXProperty Identifies the RotationX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone RotationYProperty Identifies the RotationY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows Phone 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

Image with perspective transform applied.

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

Shows stacking objects in 3d effect.

Besides creating static 3-D effects, you can animate the perspective transform properties to create moving 3-D effects.

Run this sample

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.

Run this sample

NoteNote:

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.

Run this sample

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