Drawing rectangles on to a canvas can be done fairly easily:-
<Canvas x:Name="draw" Background="Transparent" MouseLeftButtonDown="draw_MouseLeftButtonDown" />
then:-
Point origPoint;
Rectangle rect;
void draw_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
rect = new Rectangle();
origPoint = e.GetPosition(draw);
Canvas.SetLeft(rect, origPoint.X);
Canvas.SetTop(rect, origPoint.Y);
rect.Stroke = new SolidColorBrush(Colors.Black);
rect.StrokeThickness = 2;
draw.Children.Add(rect);
draw.MouseMove += draw_MouseMove;
draw.MouseLeftButtonUp += draw_MouseLeftButtonUp;
}
void draw_MouseMove(object sender, MouseEventArgs e)
{
if (rect != null)
{
Point curPoint = e.GetPosition(draw);
if (curPoint.X > origPoint.X)
{
rect.Width = curPoint.X - origPoint.X;
}
else if (curPoint.X < origPoint.X)
{
Canvas.SetLeft(rect, curPoint.X);
rect.Width = origPoint.X - curPoint.X;
}
if (curPoint.Y > origPoint.Y)
{
rect.Height = curPoint.Y - origPoint.Y;
}
else if (curPoint.Y < origPoint.Y)
{
Canvas.SetTop(rect, curPoint.Y);
rect.Height = origPoint.Y - curPoint.Y;
}
}
}
void draw_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (rect != null)
{
draw.MouseMove -= draw_MouseMove;
draw.MouseLeftButtonUp -= draw_MouseLeftButtonUp;
rect = null;
}
}
Whether this can actually full fill your requirements I'm not sure. It would really depend on what you might have underneath the canvas and what you wanted to do with the rectangles once drawn.