Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Width Property (UIElement)

Gets or sets the width of the object.

XAML
<object Width="Double" .../>
Scripting
value = object.Width
object.Width = value

Property Value

Double

The width of the object.

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

Remarks

Many of the UIElement derived objects are also derived from Shape. Not all of the Shape classes typically use Height or Width to specify their appearance, and instead use specific properties that might define a set of points. In this case a Height or Width is calculated, but is not typically set directly. For details, see Shapes and Drawing in Silverlight Overview.

TextBlock is a container object that displays text within it. The size of that text can influence the size of the rendered TextBlock, so TextBlock supports two additional properties that expose that calculated size, ActualHeight and ActualWidth. For details, see Text and Fonts Overview.

Applies To

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

See Also

Object Layout in Silverlight
Height

Community Additions

Show:
© 2015 Microsoft