private void OnDragOver(object sender, DragEventArgs dragEventArgs) { if (dragEventArgs.Data.GetDataPresent(typeof(Appointment))) { if (Appointments != null && AdornerControl != null) { if (slots == null) { ComputeSlots(currentDraggedAppointment.Id); } AdornerControl.NewMousePositionForAdorner(dragEventArgs.GetPosition(AdornerControl.ReferenceElement)); var mousePositionTime = GetTimeForPosition(dragEventArgs.GetPosition(AssociatedObject).X); var currentPointedSlot = GetSlot(mousePositionTime); if (currentPointedSlot != null) { var slotLength = new Duration(currentPointedSlot.Begin, currentPointedSlot.End); var appointmentLength = new Duration(AppointmentModifications.BeginTime, AppointmentModifications.EndTime); if (slotLength >= appointmentLength) { AdornerControl.ShowAdornerLikeDropIsPossible(); dropIsPossible = true; return; } } AdornerControl.ShowAdornerLikeDropIsNotPossible(); dropIsPossible = false; } } }
private void OnDragLeave(object sender, DragEventArgs dragEventArgs) { AdornerControl.ShowAdornerLikeDropIsNotPossible(); }