Introduction: This Blog showing how we can draw the lines in silverlight application.

Example : We have one method called DarwLine(),in which we get the line from system.windows.shapes.line,line has Stroke,StrokeThickness peroperties ,it has X1,X2,Y1,Y2 co-ordinates.. Add those line in canvas as their child element.

public void drawline()

{

line = new Line

{

Stroke = new SolidColorBrush(Colors.Red),

StrokeThickness = 1,

X2 = 50,

Y2 = 0,

X1 = 0,

Y1 =100,

};

line1 = new Line

{

Stroke = new SolidColorBrush(Colors.Black),

StrokeThickness = 1,

X2 = 50,

Y2 = 100,

X1 = 20,

Y1 = 0,

};

canvas1.Children.Add(line);

canvas1.Children.Add(line1);

}