private void SelectMultipleElements(ListBox listBox) { Debug.WriteLine(listBox.SelectedItems.Count); selectedElements = new List <VectorShapeModel>(); foreach (VectorShapeModel shape in listBox.SelectedItems) { selectedElements.Add(shape); } if (selectedElements == null || selectedElements.Count == 0) { Debug.WriteLine("selected elementS is null"); return; } Debug.WriteLine("Selected elements count: " + selectedElements.Count); System.Drawing.Point avg = UtilityStuff.GetAveragePosOfShapes(selectedElements); selectedElement = new VectorShapeModel(avg.X, avg.Y, 0, Color.FromRgb(255, 0, 0), layers[0]); multipleSelectedElements = true; OnPropetyChangedSelectedElement(); transformVisibility = Visibility.Visible; OnPropertyChanged("TransformVisibility"); }