Edit

Bagikan melalui


ManipulationPivot2D Class

Definition

Represents pivot information used by a manipulation processor for single-manipulator rotations.

public ref class ManipulationPivot2D sealed : System::Windows::Input::Manipulations::ManipulationParameters2D
public sealed class ManipulationPivot2D : System.Windows.Input.Manipulations.ManipulationParameters2D
type ManipulationPivot2D = class
    inherit ManipulationParameters2D
Public NotInheritable Class ManipulationPivot2D
Inherits ManipulationParameters2D
Inheritance
ManipulationPivot2D

Examples

The following code example shows how the X and Y properties for a pivot point are updated to match the center of the element that is being manipulated.

#region ManipulationProcessor2D
private double ElementCenterX
{
    get { return elementPosition.X; }
    set
    {
        elementPosition.X = value;
        manipulationProcessor.Pivot.X = (float)value;
    }
}

private double ElementCenterY
{
    get { return elementPosition.Y; }
    set
    {
        elementPosition.Y = value;
        manipulationProcessor.Pivot.Y = (float)value;
    }
}
#endregion

Remarks

When a ManipulationPivot2D object is assigned to the Pivot property of a ManipulationProcessor2D object, it affects how the manipulation processor calculates rotational changes to an element when the element is being manipulated by a single manipulator. If more than one manipulator is being applied to the element during manipulation, the Pivot property is ignored.

In a single-manipulator scenario, an element can rotate as it is being dragged. The X and Y properties of the ManipulationPivot2D object determine what position the element rotates around, and the Radius property is used by the manipulation processor to calculate the amount of rotational change.

For instance, if the single manipulator is near the outer edge of the pivot point, the rotational change to the element as it is being dragged will be fairly large (depending upon the size of the element). If the manipulator is close to the center of the pivot point, very little (if any) rotation will occur.

Typically, the X and Y properties represent the center of the element that is being manipulated, and the Radius property represents the distance from the center of the element to its farthest edge.

As the element moves, the X and Y properties of the ManipulationPivot2D object need to be updated so that rotation will continue to occur around the proper point.

Constructors

ManipulationPivot2D()

Initializes a new instance of the ManipulationPivot2D class.

Properties

Radius

Gets or sets the distance from the pivot point to the edge of the manipulatable region.

X

Gets or sets the X position of the pivot.

Y

Gets or sets the Y position of the pivot.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to