title: how to resize the wpf line automatically?
body: <p>I have a WPF project where i had to plot some <code>lines</code> in the project. But when i resize the window, the <code>lines</code> wouldn't resize because i using the canvas coordinate to plot the line. Anyone show me how to make the line resize vary to the window size?</p>
  
  <p>my code for the line:</p>
  
  <pre><code>public static void drawGridLines(MainWindow main)
      {
              double axisX = 10;
              Line lastLine = new Line();
              lastLine.X2 = axisX;
              lastLine.Y2 = 15;
              double y = 0;
              double x = 0;
              bool first = true;
              int[] point = new int[10] { 1, 3, 8, 9, 9, 0, 7, 5, 4, 1 };
  
          for (int i = 0; i &lt; point.Length; i++) // iterate over your gridview rows 
              {
                  Line newline = new Line();
  
                  newline.X1 = lastLine.X2;
                  newline.Y1 = lastLine.Y2;
  
                  newline.X2 = axisX + (Point[i] * 5); // calculate X position of the current cell 
                  newline.Y2 = lastLine.Y2 + 10; // calculate Y position of the current cell 
                  x = newline.X2;
                  y = newline.Y2;
  
                  if (!first)
                  {
                      // first minimum cell should't be drawn, it is just the start point for next line                  
                      drawLine(main, newline);
                  }
                  else
                  {
                      first = false;
                  }
  
                  lastLine = newline;
              }
  
  
  public static void drawLine(MainWindow main, Line line)
      {
          line.HorizontalAlignment = HorizontalAlignment.Left;
          line.VerticalAlignment = VerticalAlignment.Center;
          line.Stroke = System.Windows.Media.Brushes.SteelBlue;
          line.StrokeThickness = 1.5;
          main.myLineCanvas.Children.Add(line);
  
      }
  </code></pre>