I am working on my own graph drawing application. I have got the graph and the updating mechanisme working like i want to. Now I am trying to draw a grid, So i need some lines on the axis of my graph, so I came up with this little loop:
Gridx = new Line();
while (x <= _XAxisSize)
{
gridx.X1 = x;
gridx.X2 = x;
gridx.Y1 = _YAxisSize - 20;
gridx.Y2 = _YAxisSize + 20;
x = x + XgridSize;
gridx.UpdateLayout();
}
This doesn’t work, because it only draws one line (the last point of the loop). So i need to draw multiple lines on that axes. How dow i accomplish something like that, using either the line() from the system.Windows.Shapes library, or any other shape in that library
Thanks
If you want multiple lines, you need to create multiple lines:
However, for such static lines you might be better off looking at using a
GeometryDrawingwhich has much less overhead than theLineshape. See here for details about the differences.