Tim
Tim

Reputation: 143

C# WPF PolyLine that is 50% of my window width

this should be an easy answer for some of you maybe. I wan to draw a line that is always 50% of my window width, how do i do that? So if the user resizes the window, the line should be able to automatically adjust itself and grow/shrink to always keep 50% of my window width.

How to do that? Currently, i only have a very static line....such as....

<Polyline Points="0,0 1,0" HorizontalAlignment="Right" Width="500" Stretch="Fill" Stroke="Blue" StrokeThickness="10" />

where my window width is set to 1000.

Upvotes: 1

Views: 321

Answers (1)

Peregrine
Peregrine

Reputation: 4566

You can create the same effect with a Path control. The Data property value uses a pair of Move elements to define the nominal size of the drawing surface.

<Path Stroke="Black" StrokeThickness="5" Data="M 100,0 M 0,0 L 50,0" Stretch="Uniform" />

Upvotes: 1

Related Questions