public void OnAppointmentResizeElementMouseDown(AppointmentItem item, object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            if (item.AppointmentSlot.Occurrence.CanResizeOrMove() && !this.itemsControl.Scheduler.IsReadOnly)
            {
                var editingEvent = this.RaiseAppointmentEditingEvent(item.AppointmentSlot.Occurrence.Appointment, AppointmentEditAction.Resize);
                if (!editingEvent.Cancel)
                {
                    this.resizedAppointmentSlot = item.AppointmentSlot;

                    AppointmentResizeMode appointmentResizeMode = item.ResizeStartElement == sender
                                                                  ? AppointmentResizeMode.Start
                                                                  : AppointmentResizeMode.End;

                    this.StartResize(appointmentResizeMode, item.ResizeStartElement.Cursor);
                }
            }
        }
        private void AttachToVisualTree()
        {
            this.KeyDown += this.OnKeyDown;

            this.SubjectTextBox = this.GetTemplateChild(SubjectTextBoxName) as TextBox;

            if (this.SubjectTextBox != null)
            {
                this.SubjectTextBox.GotFocus  += this.OnSubjectTextBoxGotFocus;
                this.SubjectTextBox.LostFocus += this.OnSubjectTextBoxLostFocus;
                this.parentAppointmentItem     = this.ParentOfType <AppointmentItem>();
                this.parentAppointmentItem.MouseLeftButtonUp += this.OnParentAppointmentItemMouseLeftButtonUp;

                this.parentAppointmentItem.MouseDoubleClick += this.OnParentAppointmentItemMouseDoubleClick;

                this.parentAppointmentItem.Unselected += this.OnParentAppointmentItemUnselected;
                this.parentAppointmentItem.LostFocus  += this.OnParentAppointmentItemLostFocus;
                this.shouldStartInlineEditing          = this.parentAppointmentItem.IsSelected;
            }
        }
        internal void RecycleAllAppointmentItems()
        {
            VirtualizedAppointmentPanel panel = this.ItemsHost as VirtualizedAppointmentPanel;

            if (panel != null)
            {
                panel.RecycleAllAppointmentItems();
                panel.InvalidateMeasure();
            }
            if (this.ItemsHost != null)
            {
                foreach (UIElement item in this.ItemsHost.Children)
                {
                    AppointmentItem container = item as AppointmentItem;
                    if (container != null)
                    {
                        container.ClearValue(AppointmentItem.SchedulerProperty);
                    }
                }
            }
        }
        private void MeasureAppointmentItemAndConfigureShowMoreButton(AppointmentItem appointmentItem, List <TimeSlotItem> timeSlotItems, ref Rect rect)
        {
            List <TimeSlotItem> overlaidTimeslotItems =
                (from t in timeSlotItems
                 where appointmentItem.AppointmentSlot.TimeSlot.Contains(t.TimeSlot) && t.ContentHost != null
                 select t).ToList();

            foreach (TimeSlotItem timeSlotItem in overlaidTimeslotItems)
            {
                Rect slotRect = rect;
                if (timeSlotItem.ShowMoreButton != null)
                {
                    FrameworkElement appointmentsHost = timeSlotItem.GetChildByName("PART_ContentHost");
                    Point            bottomRight      = this.GetOffsetFromVisual(appointmentsHost);
                    bottomRight.X += appointmentsHost.ActualWidth;
                    bottomRight.Y += appointmentsHost.ActualHeight;
                    if (rect.Bottom > bottomRight.Y)
                    {
                        timeSlotItem.ShowMoreButton.Visibility = Visibility.Visible;
                    }
                }
            }
        }