Shape.Stroke Property

Gets or sets the Brush that specifies how the Shape outline is painted.

Namespace:  System.Windows.Shapes
Assembly:  System.Windows (in System.Windows.dll)

public Brush Stroke { get; set; }
<object Stroke="colorString"/>

XAML Values


Within opening and closing property elements for object.Stroke, exactly one object element for a class that derives from Brush. This is typically one of the following: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, or VideoBrush.


The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See "XAML Attribute Syntax" section in the SolidColorBrush topic.

Property Value

Type: System.Windows.Media.Brush
A Brush that specifies how the Shape outline is painted. The default is null.

Dependency property identifier field: StrokeProperty

Setting the Stroke for a line (Line or Polyline) defines its entire brush-defined appearance. Setting Fill for a line has no effect.

Some brush types (SolidColorBrush) support a XAML attribute syntax, whereas other brush types (ImageBrush, LinearGradientBrush, RadialGradientBrush) only support an object element syntax. This is why two versions of XAML syntax are shown for this property.

Note that you cannot re-use an existing Brush that has already been applied. For instance you cannot set an object's Stroke to the Stroke value of another object.

There is also an object named Stroke. This object is not directly related to the Stroke property; the Stroke object is part of the object model for ink support in Silverlight.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions