Rasto
Rasto

Reputation: 17844

How to specify rectangle stroke only on left and right in WPF?

I want to have rectangle that should have stroke only on left and right side(not on upper and lower side). How can I do it ?

Upvotes: 9

Views: 8603

Answers (2)

Wiseguy_7_7
Wiseguy_7_7

Reputation: 1

you could use StrokeDashArray.

alternating between strokes at each vertex.

not perfect solution but with a bit of tweeking has worked well for me.

Upvotes: 0

Dan Puzey
Dan Puzey

Reputation: 34218

You can't - a rectangle only has a single stroke thickness. A Border, though, uses a thickness structure that can have different thickness on each side:

<Border BorderThickness="5,0,5,0" BorderBrush="Black" />

Upvotes: 15

Related Questions