Export (0) Print
Expand All
Key
M11
M12
M21
M22
Tag
Uri
X1
X2
Y1
Y2
Expand Minimize

Stroke (Shape)

Silverlight

Gets or sets the Brush that specifies how to paint the Shape outline.

<object Stroke="colorString"  .../>
-or-
<object>
  <object.Stroke>
    singleBrush
  </object.Stroke>
</object>
value = object.Stroke
object.Stroke = value

Value

Description

colorString

The Color for a SolidColorBrush expressed as an attribute string. See the Color reference topic.

singleBrush

Within opening and closing property element tags for object.Stroke, exactly one object element for an object that derives from Brush. The object element can be one of the following: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, VideoBrush.

Type: Brush

A Brush that specifies how the Shape outline is painted.

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

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.

In script, you can set the Stroke property by using one of the following techniques:

  • A string that declares a Color. For more information about the Color string format options and grammar, see the Color reference topic.

  • An object that derives from Brush (such as ImageBrush, LinearGradientBrush, and RadialGradientBrush) that you have created by calling CreateFromXaml.

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; it is part of the object model for ink support in Silverlight.

Community Additions

ADD
Show:
© 2014 Microsoft