Bagikan melalui


StrokeDashArray

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

Sets a string of double values that indicates the pattern of dashes and gaps that is used to outline shapes.

<object StrokeDashArray="strokeDashString"  .../>
object.StrokeDashArray = "strokeDashString"

Property Value

Type: string

A string of delimited double values that specify the pattern of dashes and gaps.

This property is write-only.

strokeDashString Grammar

S[,G][,S*,G**]*

S

A double value that defines the length of the first stroke in the sequence.

G

A double value that defines the length of the first gap between strokes in the sequence. If G is omitted, the gap length is identical to the preceding stroke length.

S*

A double value that defines the length of the additional strokes in the sequence.

G*

A double value that defines the length of additional gaps between strokes in the sequence. If G* is omitted, the gap length is identical to the preceding stroke length.

  • The [] (bracket) characters are not literals, they are indicators of optional values. The asterisk (*) indicates that any number of stroke-dash pairs beyond the initial S,G is permitted.

  • The separator in this grammar can be either a space or a comma. You can use a mixture of spaces and commas as separators.

  • Each Double value in the string specifies the length of a stroke or gap relative to the thickness of the pen as a factor. For example, a value of 1 creates a dash or gap that has the same length as the thickness of the pen (a square).

  • If the string contains an odd number of entries, the missing even-numbered entry of a pair will use the gap value specified by the last valid (even-numbered entry) gap value.

Managed Equivalent

StrokeDashArray

Remarks

Multiple pairs of entries can be included in the string, and will repeat in a pattern. Even-numbered entries always specify gaps; odd-numbered entries always specify dashes.

A set of dashes is defined through a string syntax, which is enabled by an underlying type converter. The object model does not contain an object for accessing the set of dashes as a collection. In both script and XAML, StrokeDashArray is write-only. Attempting to get a value through scripting will result in a run-time GetValue error.