public static Rectangle AddRectangle(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle) { Rectangle rectangle = new Rectangle { Width = width, Height = height }; rectangle.UpdateShape(shapeStyle); Canvas.SetLeft(rectangle, x); Canvas.SetTop(rectangle, y); canvas.Children.Add(rectangle); return(rectangle); }
public static Rectangle AddRectangle(this Canvas canvas, double x, double y, double width, double height, ShapeStyle shapeStyle) { Rectangle rectangle = new Rectangle { Width = width, Height = height }; rectangle.UpdateShape(shapeStyle); Canvas.SetLeft(rectangle, x); Canvas.SetTop(rectangle, y); canvas.Children.Add(rectangle); return rectangle; }