Shape.Stroke Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace: System.Windows.Shapes
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.


Public Property Stroke As Brush
public Brush Stroke { get; set; }

<object Stroke="colorString"/>

XAML Values

Property Value

Type: System.Windows.Media..::.Brush
A Brush that specifies how the Shape outline is painted. The default is nullNothingnullptra null reference (Nothing in Visual Basic).


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 Windows Phone.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0


Windows Phone

See Also


Shape Class

System.Windows.Shapes Namespace