WPFwiki, wpf, wiki, .net 3.0, windows presentation foundation, FAQ, free resources, solution, development, microsoft Home of the world's largest WPF FAQ
Edit

Category

Drawing

Edit

Question

Since the Line shape requires explicit start and end point coordinates, how do I draw a line whose position and length are to be managed by the layout Panel which contains the line?

Edit

Answer

Use 0 or 1 as X and Y coordinates for both points, and set the Stretch property to Fill.

For example, the following code draws a horizontal line whose length will be determined by the containing Panel's width:

<Line X1="0" Y1="0"
      X2="1" Y2="0"
      Stretch="Fill" />


Edit

Source Link

http://groups.google.com/group/microsoft.public.windows.developer.winfx.avalon/browse_frm/thread/1bbeb1d8e4c91789/d9200befabc273a7?q=line+stretch&rnum=1#d9200befabc273a7

Edit

Keywords

line, shape, drawing, stretch, layout

All content is Copyright ©2007 Xceed Software Inc. unless otherwise indicated. See the Terms of Service. Contributors must read and agree to the Contribution Policy. WPFwiki is brought to you by Xceed, makers of the powerful yet free Xceed DataGrid for WPF.