Пример #1
0
        internal void ArrangeVisualElement()
        {
            RadCalendar calendar = this.Owner;
            CalendarMultiDayViewModel multiDayViewModel = calendar.Model.multiDayViewModel;

            if (multiDayViewModel.allDayAppointmentInfos != null && multiDayViewModel.allDayAppointmentInfos.Count > 0)
            {
                Size availableCalendarViewSize = calendar.CalendarViewSize;

                double timeRulerWidth   = multiDayViewModel.timeRulerWidth;
                double totalWidth       = (availableCalendarViewSize.Width - timeRulerWidth) * 2;
                double allDayAreaHeight = multiDayViewModel.totalAllDayAreaHeight;

                this.allDayAreaScrollViewer.Width  = 2 * totalWidth;
                this.allDayAreaScrollViewer.Height = allDayAreaHeight;

                int allDayAreaRowCount = multiDayViewModel.allDayAreaRowCount;
                this.allDayAreaPanel.Height = multiDayViewModel.allDayAppointmentInfos.First().layoutSlot.Bottom *allDayAreaRowCount
                                              + (allDayAreaRowCount - 1) * calendar.MultiDayViewSettings.AllDayAppointmentSpacing;

                double cellHeight = multiDayViewModel.dayViewLayoutSlot.Height / multiDayViewModel.SpecificColumnCount;
                double topOffset  = Math.Abs(cellHeight + multiDayViewModel.dayViewLayoutSlot.Y + calendar.GridLinesThickness);
                Canvas.SetTop(this.allDayAreaScrollViewer, topOffset);
                this.UpdatePanelBackground(calendar.MultiDayViewSettings.AllDayAreaBackground);
            }
            else
            {
                this.allDayAreaPanel.Height        = 0;
                this.allDayAreaScrollViewer.Width  = 0;
                this.allDayAreaScrollViewer.Height = 0;
            }
        }
Пример #2
0
        internal void ScrollAppointmentIntoView(IAppointment appointment)
        {
            RadCalendar calendar = this.Owner;

            if (calendar != null)
            {
                CalendarMultiDayViewModel model = calendar.Model.multiDayViewModel;
                var appointmentInfos            = model.appointmentInfos;
                if (appointmentInfos != null && appointmentInfos.Count > 0)
                {
                    DateTime startDate = calendar.DisplayDate;
                    DateTime endDate   = calendar.DisplayDate.AddDays(calendar.MultiDayViewSettings.VisibleDays - 1);
                    CalendarAppointmentInfo appointmentInfo = appointmentInfos.FirstOrDefault(a => a.childAppointment == appointment && startDate <= a.Date && endDate >= a.Date);
                    if (appointmentInfo != null)
                    {
                        RadRect layoutSlot = appointmentInfo.layoutSlot;
                        if (this.scrollViewer.VerticalOffset != layoutSlot.Y)
                        {
                            this.isScrollingInvoked = true;
                            this.scrollViewer.ChangeView(0.0f, layoutSlot.Y, 1.0f);
                        }
                    }
                }
            }
        }
Пример #3
0
        public CalendarModel(IView calendar)
        {
            this.DisplayDate = DateTime.Today;

            this.TrackPropertyChanged = true;

            this.View = calendar;

            this.multiDayViewModel = new CalendarMultiDayViewModel();
            this.children.Add(this.multiDayViewModel);

            this.monthViewModel = new CalendarMonthViewModel();
            this.children.Add(this.monthViewModel);

            this.yearViewModel = new CalendarYearViewModel();
            this.children.Add(this.yearViewModel);

            this.decadeViewModel = new CalendarDecadeViewModel();
            this.children.Add(this.decadeViewModel);

            this.centuryViewModel = new CalendarCenturyViewModel();
            this.children.Add(this.centuryViewModel);

            this.UpdateCurrentView();
        }
Пример #4
0
        internal void ArrangeVisualElement()
        {
            RadCalendar calendar = this.Owner;
            Size        availableCalendarViewSize       = calendar.CalendarViewSize;
            CalendarMultiDayViewModel multiDayViewModel = calendar.Model.multiDayViewModel;

            double allDayAreaHeight = multiDayViewModel.totalAllDayAreaHeight;
            double timeRulerWidth   = multiDayViewModel.timeRulerWidth;
            double totalWidth       = (availableCalendarViewSize.Width - timeRulerWidth) * 2;

            this.leftOffset = totalWidth / 2 + timeRulerWidth - calendar.GridLinesThickness / 2;
            foreach (var topHeaderChild in this.topHeader.Children)
            {
                if (topHeaderChild.RenderTransform != this.translateTransform)
                {
                    topHeaderChild.RenderTransform = this.translateTransform;
                }
                Canvas.SetLeft(topHeaderChild, -this.leftOffset);
            }

            Canvas.SetLeft(this.topHeader, -this.leftOffset);

            this.scrollViewer.Width  = availableCalendarViewSize.Width;
            this.scrollViewer.Height = availableCalendarViewSize.Height;

            this.contentPanel.Width = totalWidth;

            double cellHeight = multiDayViewModel.dayViewLayoutSlot.Height / multiDayViewModel.SpecificColumnCount;
            double topOffset  = Math.Abs(cellHeight + multiDayViewModel.dayViewLayoutSlot.Y + calendar.GridLinesThickness);

            this.topLeftHeaderPanel.Height = topOffset + allDayAreaHeight;
            this.topLeftHeaderPanel.Width  = timeRulerWidth;

            this.topHeader.Height = topOffset + allDayAreaHeight;
            this.topHeader.Width  = totalWidth + this.leftOffset;

            if (multiDayViewModel.timeRulerItems != null && multiDayViewModel.timeRulerItems.Count > 0)
            {
                RadRect lastItemSlot = multiDayViewModel.timeRulerItems[multiDayViewModel.timeRulerItems.Count - 1].layoutSlot;
                this.contentPanel.Height = lastItemSlot.Y + lastItemSlot.Height;
                this.contentPanel.Width  = this.scrollViewer.Width;

                this.leftHeaderPanel.Height = lastItemSlot.Y + lastItemSlot.Height;
                this.leftHeaderPanel.Width  = multiDayViewModel.timeRulerWidth;
            }

            this.UpdatePanelsBackground(calendar.MultiDayViewSettings.TimelineBackground);
        }
Пример #5
0
        internal void UpdateTimeRulerDecorations(CalendarMultiDayViewModel model, bool areDayNamesVisible)
        {
            CalendarGridLine horizontalAllDayLowerLine = model.horizontalLowerAllDayAreaRulerGridLine;
            CalendarGridLine horizontalAllDayUpperLine = model.horizontalUpperAllDayAreaRulerGridLine;
            CalendarGridLine horizontalTopHeaderLine   = model.horizontalTopHeaderRulerGridLine;
            CalendarGridLine verticalLine = model.verticalRulerGridLine;

            if (this.horizontalLowerGridLineBorder == null)
            {
                this.horizontalLowerGridLineBorder = new Border();
                this.topLeftHeaderPanel.Children.Add(this.horizontalLowerGridLineBorder);
            }

            if (this.horizontaUpperGridLineBorder == null)
            {
                this.horizontaUpperGridLineBorder = new Border();
                this.topLeftHeaderPanel.Children.Add(this.horizontaUpperGridLineBorder);
            }

            if (this.horizontaTopHeaderGridLineBorder == null)
            {
                this.horizontaTopHeaderGridLineBorder = new Border();
                this.topLeftHeaderPanel.Children.Add(this.horizontaTopHeaderGridLineBorder);
            }

            if (areDayNamesVisible && this.horizontaTopHeaderGridLineBorder.Visibility == Visibility.Collapsed)
            {
                this.horizontaTopHeaderGridLineBorder.Visibility = Visibility.Visible;
            }
            else if (!areDayNamesVisible && this.horizontaTopHeaderGridLineBorder.Visibility == Visibility.Visible)
            {
                this.horizontaTopHeaderGridLineBorder.Visibility = Visibility.Collapsed;
            }

            if (this.verticalGridLineBorder == null)
            {
                this.verticalGridLineBorder = new Border();
                this.topLeftHeaderPanel.Children.Add(this.verticalGridLineBorder);
            }

            this.LayoutTopAllDayAreaHorizontalBorder(horizontalAllDayUpperLine);
            this.LayoutLowerAllDayAreaHorizontalBorder(horizontalAllDayLowerLine);
            this.LayoutTopHeaderHorizontalBorder(horizontalTopHeaderLine);
            this.LayoutVerticalHeaderBorder(verticalLine);
        }