Dynamically drawing a line in WPF

I just bought "Pro C# 2008 and the .NET 3.5 Platform" 4th Edition by Andrew Troelsen. I like it- it's been an invaluable resource. However, either I gave up too soon or it just wasn't covered in the book as to how to simply programmatically draw a line in C# for a WPF custom control.

I figured out how to do exactly what I needed via this link: http://msdn2.microsoft.com/en-us/library/aa480159.aspx

Here's the gist of it:
Define a Canvas (mine was named "canvas") in your custom control XAML.
In the C# code-behind file, simply do this:
Line line = new Line();
line.X1 = 0;
line.X2 = canvas.ActualWidth - 1;
line.Y1 = 0;
line.Y2 = canvas.ActualHeight - 1;
line.Stroke = Brushes.LimeGreen;
line.StrokeThickness = 1; // Note1
canvas.Children.Insert(0, line);

That's it.
(You'll need to use the System.Windows.Media and System.Windows.Shapes namespaces, of course.)

Note1: On MSDN's site, there is the following erroneous code:
segmentAnimation.StrokeThickness = new System.Windows.Length(1);

For whatever reason, coming by this knowledge was a little trickier than I expected, so I wanted to share it with y'all to ease your way.

Regards,
Xenadmin