public void SwapPhoneNumbersAtPos(int x1, int y1, int x2, int y2) { PhoneNumber p1 = PhoneNumberGet(x1, y1); PhoneNumber p2 = PhoneNumberGet(x2, y2); //sanity check, no point of swapping same cells if (p1 == p2) { return; } //sanity check, dragging cell out of draw area if (p1 == null || p2 == null) { return; } Grid.SetColumn(p1, x2); Grid.SetRow(p1, y2); Grid.SetColumn(p2, x1); Grid.SetRow(p2, y1); p1.SetCoordinate(x2, y2); p2.SetCoordinate(x1, y1); }