Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

Point Object

Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.

XAML
<object property = "pointString" ... />
Scripting
object.property = "pointString"

pointString Grammar

X,Y
-or-
X Y
  • X is the X (horizontal) point position in pixels. Y is the Y (vertical) point position in pixels.
  • X and Y can be negative, with the result that the Rect definition is off the screen, unless there is additional translation.
  • X and Y can be non-integer values in terms of permitted values, but are interpreted as integers regardless during rendering.
  • You can use a space rather than a comma as the delimiter betweeen X and Y.

Properties

Name, X, Y

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

The Point object parallels a convention that is supported by a type converter, such that properties that take a Point as their value can specify a Point as a formatted string. The type converter generates a new Point value based on processing the string. The type converter functions both for XAML usages and script usages. In both cases, you supply a quoted string. The format of that string is an X,Y value pair.

X and Y can be non-integer values in terms of permitted values, but are interpreted as integers regardless during rendering. In general, you should not use noninteger values. In particular, the comma used as X,Y separator in the type converter behavior will clash with cultural usages where the comma is the decimal division symbol if that value is entered as a string.

Point is the type that is returned from a call to the GetPosition method used in mouse event handlers. Also, a Point is used for some properties such as To and From of a PointAnimation. For these cases, Point is a true object. You can get X and Y values from the GetPosition return value, but you cannot set them. You can get and set X and Y values from a PointAnimation property.

Point is also used extensively as a property value in geometry-related objects and for InkPresenter. If you attempt to get values through scripting for these Point values, the GetValue call will fail. This is because the object model does not use Point as a true object for these particular properties, and the type conversion behavior does not provide a reverse conversion to provide a "ToString" or other value representation to the object model.

In scripting, it is generally true that you cannot construct a new Silverlight object based on a constructor. However, for cases of types that have type converter support, you can use the type converter behavior to generate the object from out of a convertible type, in this case a string. So, in order to generate a Point value in script, you must target a property that takes a Point (such as EndPoint in the example).

Examples

JavaScript
function moveLine(sender, args) {
   myPath = sender.findName("myPath");
   myPath.Data.EndPoint = "250,150";
}

In this example, myPath is a Path previously defined in XAML, and the function is attached to a Canvas root as a mouse event handler.

See Also

Path Markup Syntax
Silverlight Transforms Overview

Community Additions

Show:
© 2015 Microsoft