예제 #1
0
        private void OnAppointmentItemDragInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DragCancel)
            {
                TimeSlotItemsControl.ChangeAllDraggedItemsOpacity(this);
                if (this.ParentItemsControl != null && this.ParentItemsControl.TimeSlotItemsControl != null)
                {
                    this.ParentItemsControl.TimeSlotItemsControl.ClearAllItemsIsDropPossibleProperty();
                }
            }
            else if (e.Options.Status == DragStatus.DragInProgress)
            {
                if (Keyboard.Modifiers != ModifierKeys.Control)
                {
                    var draggedAppointmentItems = from app in this.ParentItemsControl.AppointmentItems
                                                  where app != null && app.AppointmentSlot.Occurrence.Appointment == this.AppointmentSlot.Occurrence.Appointment
                                                  select app;

                    foreach (var app in draggedAppointmentItems)
                    {
                        app.Opacity = 0;
                    }
                }
            }
        }
예제 #2
0
        private Size GetTimeSlotItemContentHostRenderSize(out int timeSlotsCount)
        {
            timeSlotsCount = 0;
            Size timeSlotSize = Size.Empty;
            TimeSlotItemsControl timeSlotItemsControl = this.TimeSlotItemsControl;

            if (timeSlotItemsControl != null)
            {
                timeSlotsCount = timeSlotItemsControl.Items.Count;
                for (int i = 0; i < timeSlotsCount; i++)
                {
                    TimeSlotItem item = timeSlotItemsControl.ItemContainerGenerator.ContainerFromIndex(i) as TimeSlotItem;
                    if (item != null)
                    {
                        var contentHost = item.ContentHost ?? item;
                        timeSlotSize = contentHost.RenderSize;
                        break;
                    }
                }
            }

            return(timeSlotSize);
        }