Describes the width, height, and point origin of a rectangle.
Assembly: System.Windows (in System.Windows.dll)
You can use a space rather than a comma as the delimiter between values. Mixed delimiter usages are also permitted.
You must specify all four values. 0,0 is not an implicit default for x,y, and no other conventions exist that can parse less than four values in the string.
X and Y can be negative. width, and height can be negative and will invert the direction that width, and height are applied in rendering. See Remarks.
Thetype exposes the following members.
|Rect(Point, Point)||Initializes a structure that is exactly large enough to contain the two specified points.|
|Rect(Point, Size)||Initializes a structure based on an origin and size.|
|Rect(Double, Double, Double, Double)||Initializes a structure that has the specified x-coordinate, y-coordinate, width, and height.|
|Bottom||Gets the y-axis value of the bottom of the rectangle.|
|Empty||Gets a special value that represents a rectangle with no position or area.|
|Height||Gets or sets the height of the rectangle.|
|IsEmpty||Gets a value that indicates whether the rectangle is the Empty rectangle.|
|Left||Gets the x-axis value of the left side of the rectangle.|
|Right||Gets the x-axis value of the right side of the rectangle.|
|Top||Gets the y-axis position of the top of the rectangle.|
|Width||Gets or sets the width of the rectangle.|
|X||Gets or sets the x-axis value of the left side of the rectangle.|
|Y||Gets or sets the y-axis value of the top side of the rectangle.|
|Contains||Indicates whether the rectangle described by the contains the specified point.|
|Equals(Object)||Indicates whether the specified object is equal to the current . (Overrides ValueType.Equals(Object).)|
|Equals(Rect)||Indicates whether the specified is equal to the current .|
|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.)|
|GetHashCode||Creates a hash code for the . (Overrides ValueType.GetHashCode().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|Intersect||Finds the intersection of the rectangle represented by the current and the rectangle represented by the specified , and stores the result as the current .|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString()||Returns a string representation of the structure. (Overrides ValueType.ToString().)|
|ToString(IFormatProvider)||Returns a string representation of the rectangle by using the specified format provider.|
|Union(Point)||Expands the rectangle represented by the current exactly enough to contain the specified point.|
|Union(Rect)||Expands the rectangle represented by the current exactly enough to contain the specified rectangle.|
Size is a similar structure that uses the same metaphor of specifying a height and width. However, a specifies an origin point, whereas a Size does not. In general, is used for APIs that relate to graphical presentation, and Size is used for APIs that relate to UI presentation and layout.
Do not confuse and Rectangle. is a common data structure that is used to specify rectangular regions as a single value for certain properties. But has no meaning of its own or any direct UI connotation. The meaning of a is entirely dependent on how it is handled as a value for a particular property. In contrast, a Rectangle is a Shape and therefore a UIElement. A Rectangle can be specified as a XAML element and instantiates a rectangular shape that is displayed in the UI and can process input events.
The programmatic upper limit for values is not PositiveInfinity, it is a lower number (approximately 1,000,000) that is enforced by the Silverlight native code.
Properties of do not support an attribute syntax in XAML for Silverlight. In XAML you should always specify -type properties through one of the following usages:
The XAML attribute usage, which infers properties that use the type and uses a type converter to process the attribute string into the specific values for the .
A property element usage, containing a object element. For that object element, set the properties using initialization text, as shown in the XAML Object Element Usage.
If you specify a for use as a resource, use the object element usage and set the properties using initialization text.
width and height can be negative if they are specified in XAML as part of the attribute string, with the result that the direction that the width or height applies to is inverted. For instance, a height of -20 will produce a where the X,Y point is now the bottom left corner. However, the Rect constructor in the managed API does not permit negative values for width and height. You should adjust the coordinate reference of x,y, width and height such that the can be specified using non-negative width and height values.
The following notes on values apply for a that is created in XAML as well as a that is constructed in code.
X and Y can be negative, with the result that the definition is off the screen, unless there is additional translation.
X, Y, width and height can be non-integer values in terms of permitted values.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.