xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525" >
private void canvas4_MouseDown(object sender, MouseButtonEventArgs e)
{
double mouseX = 100;
double Height = canvas4.Height;
Line line1 = new Line();
line1.X1 = mouseX;
line1.Y1 = 0;
line1.X2 = mouseX;
line1.Y2 = Height;
line1.StrokeThickness = 0.5;
line1.Stroke = System.Windows.Media.Brushes.Blue;
canvas4.Children.Add(line1);
}