private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var rectangleClicked = sender as Rectangle; var window = new RectangleWindow(rectangleClicked) { Owner = this }; window.ShowDialog(); UpdateObjectValues(Cnv.Children.IndexOf(rectangleClicked), window.ResultedRectangle); e.Handled = true; }
private void RectangleSettings(Point mousePosition) { var window = new RectangleWindow() { Owner = this }; window.ShowDialog(); var rectangle = window.ResultedRectangle; if (rectangle != null) { rectangle.SetValue(Canvas.LeftProperty, mousePosition.X); rectangle.SetValue(Canvas.TopProperty, mousePosition.Y); rectangle.MouseLeftButtonUp += Rectangle_MouseLeftButtonUp; Cnv.Children.Add(rectangle); undoStack.Push(new Tuple <string, int, object>("add", Cnv.Children.IndexOf(rectangle), rectangle)); } }