Simple (I think) Horizontal Line in WPF?

Phil Sandler picture Phil Sandler · Feb 23, 2010 · Viewed 137k times · Source

Creating a relatively simple data entry form, and just want to separate certain sections with a horizontal line (not unlike an HR tag in HTML) that stretches the full length of the form.

I have tried this:

<Line Stretch="Fill" Stroke="Black" X2="1"/>

Because the parent control is not a fixed width, this line causes the window to stretch to the full width of the screen.

Is there an easy way to do this without fixing the width of my parent control/window?

Answer

Adel Hazzah picture Adel Hazzah · Feb 23, 2010

How about add this to your xaml:

<Separator/>