Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Point Structure

Updated: December 2008

Represents an x- and y-coordinate pair in two-dimensional 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(PointConverter))]
public struct Point : IFormattable
<object property="x,y"/>
-or-
<object property="x y"/>

XAML Values

x

The x-coordinate of this Point.

y

The y-coordinate of this Point.

In XAML, the delimiter between the X and Y values of a Point 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 Point in XAML, because that will clash with the string type conversion of a Point attribute value into the X and Y components.

The following example shows how to check if two Point structures are not equal. It also illustrates how to assign values to a Point structure when the structure is being declared and after the structure has been declared.

// Checks if two Points are equal using the overloaded inequality operator. 
private Boolean pointInequalityExample()
{
    // Checks if two Points are not equal using the overloaded inequality operator. 

    // Declaring point1 and initializing x,y values
    Point point1 = new Point(10, 5);

    // Declaring point2 without initializing x,y values
    Point point2 = new Point();

    // Boolean to hold the result of the comparison
    Boolean areNotEqual;

    // assigning values to point2
    point2.X = 15;
    point2.Y = 40;

    // Compare Point structures for equality. 
    // areNotEqual is True
    areNotEqual = (point1 != point2);

    return areNotEqual;

}

More Code

How to: Make an Object Follow the Mouse Pointer This example shows how to change the dimensions of an object when the mouse pointer moves on the screen.
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

Date

History

Reason

December 2008

XAML authoring to account for dual delimiters and note possible locale issues with , as the delimiter.

Information enhancement.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.