Canvas.Top Property

Gets or sets a value that represents the distance between the top of an element and the top of its parent Canvas.

XAML
<object Canvas.Top="Double" .../>
Scripting
value = object["Canvas.Top"]
object["Canvas.Top"] = value

Property Value

Double

A value that represents the offset position from the top of a parent Canvas.

This property is read/write. The default value is 0.

Remarks

Negative values are permitted. A negative value will place the origin of the element where Canvas.Top is applied offscreen to the top side of the content area.

This property is an example of an attached property, whereby non-Canvas objects can set this property that can then be read and interpreted by a parent Canvas .

Notice particularly the script syntax, which resembles an indexer or array syntax. The ["ownerType.propertyName"] form (with no dot separating this property form and the target object for getting or setting) is necessary to get or set an attached property such as Canvas.Top in script.

The value is interpreted by any immediate parent Canvas. If there are nested canvas elements, values for Canvas.Top that do not come from immediate child elements are ignored. A Canvas can itself have a Canvas.Top value, but the value does not apply on itself, rather it is interpreted by any parent Canvas, as in the nested scenario mentioned.

Canvas.Left or Canvas.Top values on the root canvas are ignored and are not used for positioning by the Silverlight plug-in's content area.

For more details on object positioning and how Canvas.Top participates, see Object Layout in Silverlight.

Applies To

Canvas, Ellipse, Glyphs, Image, InkPresenter, Line, MediaElement, Path, Polygon, Polyline, Rectangle, TextBlock

See Also

Object Layout in Silverlight
Silverlight Transforms Overview
Canvas.Left
Canvas.ZIndex