Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Vector Structure

Represents a displacement in 2-D space.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[SerializableAttribute]
[TypeConverterAttribute(typeof(VectorConverter))]
public struct Vector : IFormattable
<object property="x,y"/>
-or-
<object property="x y"/>

XAML Values

x

The vector's X component. For more information, see the X property.

y

The vector's Y component. For more information, see the Y property.

A Point represents a fixed position, but a Vector represents a direction and a magnitude (for example, velocity or acceleration). Thus, the endpoints of a line segment are points but their difference is a vector; that is, the direction and length of that line segment.

In XAML, the delimiter between the X and Y values of a Vector can be either a comma or a space.

Some cultures might use the comma character as the decimal delimiter instead of the period character. XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. You should avoid using the comma character as the decimal delimiter if specifying a Vector in XAML, because that will clash with the string type conversion of a Vector attribute value into the X and Y components.

This example shows how to add two Vector structures.

// Adds a Vector to a Vector using the overloaded + operator.  

Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
Vector vectorResult = new Vector();


// vectorResult is equal to (65,100)
vectorResult = vector1 + vector2;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0

Community Additions

Show:
© 2014 Microsoft