Tony
Tony

Reputation: 1532

WPF dashed line — fix dashes during resize

How can I avoid line dash resize during the window resize? Consider the following image: http://leprastuff.ru/data/img/20130315/b83eea4a7a3f07ca53a0e118ddbb9230.Gif

<Rectangle SnapsToDevicePixels="True"
           Stroke="DarkGray"
           StrokeDashArray="10 10"
           StrokeThickness="1" />

Thanks, Tony.

Upvotes: 2

Views: 2524

Answers (1)

Clemens
Clemens

Reputation: 128147

Set the Height of the Rectangle to something greater than one.

Currently you're drawing the upper and lower border on top of each other. As the dashed stroke draws the Rectangle's border clockwise, starting at the top-left corner, you get the observed behaviour.

If you intended to draw a Rectangle with a height of one, you might better draw a Line instead.

Upvotes: 3

Related Questions