다음을 통해 공유


Shape.Stroke Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Property Stroke As Brush
public Brush Stroke { get; set; }
<object>
  <object.Stroke>
    singleBrush
  </object.Stroke>
</object>
<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 nulla null reference (Nothing in Visual Basic).

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

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

Platforms

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