private void MainCanvas_MouseDown(object sender, MouseButtonEventArgs e) { LastPoint = Mouse.GetPosition(MainCanvas); if (drawInProgress) { Box = new BoundingBox(MainCanvas, LastPoint); boxes.Add(Box); } else { if (Box != null && Box.CheckAdornerHit(LastPoint)) { // resizing exiting box resizeInProgress = true; } else if (Box != null && Box.SelectTest(LastPoint)) { // moving box } else { foreach (var mainCanvasChild in boxes) { mainCanvasChild.SelectTest(LastPoint); } var selectedItems = boxes.Where(x => x.IsSelected); if (selectedItems.Any()) { if (selectedItems.Count() > 1) { var itemsToUnselect = selectedItems.Reverse().Skip(1); foreach (var boundingBox in itemsToUnselect) { boundingBox.UnSelect(); } } Box = selectedItems.First(); } else { Box = null; } } } }