Silverlight DashArray in VB.NET

In this article you will learn about the DashArray in Silverlight.
  • 2059

DashArray: "StrokeDashArray" is the property which we use to define our dashes.  This property indicates the pattern of dashes and spaces between the dashes.  The first value is the width of the dash and the second value is the space between the dashes.

All you need is to define an array of double, size 2, and set the length of the dash as first element and the spacing between to dashes as second element of the array.

Both values are specific to the thickness of the line being drawn, so {1,1} will draw a dotted line (actually a dashed lines with square dashes).

And you want to draw more complex dashed lines, for example like the ones used in technical drawings, you can add to the array other couples of doubles, and draw dash-dot sequences: every even values is the length of dashes, odd values specifies gaps.

Example of StrokDeshArray 

<UserControl x:Class="SilverlightApplication21.MainPage"
    <Canvas xmlns="">
        StrokeDashArray="7, 5, 3, 6"

Output WIndow



Hope this article will help you to understand the working of  StrokDeshArray in Silverlight.


More Articles

© 2020 DotNetHeaven. All rights reserved.