private void LayoutLowerAllDayAreaHorizontalBorder(CalendarGridLine horizontalAllDayLowerLine)
        {
            MultiDayViewSettings settings = this.Owner.MultiDayViewSettings;
            Style allDayAreaBorderStyle   = settings.AllDayAreaBorderStyle ?? settings.defaultAllDayAreaBorderStyle;

            if (allDayAreaBorderStyle != null)
            {
                this.horizontalLowerGridLineBorder.Style = allDayAreaBorderStyle;
            }

            if (!XamlDecorationLayer.IsStrokeBrushExplicitlySet(this.horizontalLowerGridLineBorder.Style))
            {
                this.horizontalLowerGridLineBorder.BorderBrush = this.Owner.GridLinesBrush;
            }

            if (this.horizontalLowerGridLineBorder.BorderBrush != null && !XamlDecorationLayer.IsStrokeThicknessExplicitlySet(this.horizontalLowerGridLineBorder.Style))
            {
                this.horizontalLowerGridLineBorder.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
            }

            RadRect layoutSlot = horizontalAllDayLowerLine.layoutSlot;

            layoutSlot.Height = this.horizontalLowerGridLineBorder.BorderThickness.Left;
            XamlMultiDayViewLayer.ArrangeUIElement(this.horizontalLowerGridLineBorder, layoutSlot, true);
        }
        internal void UpdateTimeRulerAllDayText(RadRect allDayLabelLayout)
        {
            if (allDayLabelLayout != RadRect.Empty)
            {
                if (this.allDayTextBlock == null)
                {
                    this.allDayTextBlock = new TextBlock();
                    this.topLeftHeaderPanel.Children.Add(this.allDayTextBlock);
                }

                MultiDayViewSettings settings = this.Owner.MultiDayViewSettings;
                Style allDayAreaTextStyle     = settings.AllDayAreaTextStyle ?? settings.defaultAllDayAreaTextStyle;
                if (allDayAreaTextStyle != null)
                {
                    this.allDayTextBlock.Style = allDayAreaTextStyle;
                }

                if (this.allDayTextBlock.Text != null && !this.IsTextExplicitlySet(this.allDayTextBlock.Style))
                {
                    this.allDayTextBlock.Text = settings.AllDayAreaText;
                }

                if (this.allDayTextBlock.Visibility == Visibility.Collapsed)
                {
                    this.allDayTextBlock.Visibility = Visibility.Visible;
                }

                XamlMultiDayViewLayer.ArrangeUIElement(this.allDayTextBlock, allDayLabelLayout, true);
            }
            else if (this.allDayTextBlock != null && this.allDayTextBlock.Visibility == Visibility.Visible)
            {
                this.allDayTextBlock.Visibility = Visibility.Collapsed;
            }
        }
        private void LayoutTopAllDayAreaHorizontalBorder(CalendarGridLine horizontalAllDayUpperLine)
        {
            this.ApplyTimeRulerStyle(horizontalAllDayUpperLine, this.horizontaUpperGridLineBorder);

            if (!XamlDecorationLayer.IsStrokeBrushExplicitlySet(this.horizontaUpperGridLineBorder.Style))
            {
                this.horizontaUpperGridLineBorder.BorderBrush = this.Owner.GridLinesBrush;
            }

            if (this.horizontaUpperGridLineBorder.BorderBrush != null && !XamlDecorationLayer.IsStrokeThicknessExplicitlySet(this.horizontaUpperGridLineBorder.Style))
            {
                this.horizontaUpperGridLineBorder.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
            }

            RadRect layoutSlot = horizontalAllDayUpperLine.layoutSlot;

            XamlMultiDayViewLayer.ArrangeUIElement(this.horizontaUpperGridLineBorder, layoutSlot, true);
        }
        private void LayoutVerticalHeaderBorder(CalendarGridLine verticalLine)
        {
            this.ApplyTimeRulerStyle(verticalLine, this.verticalGridLineBorder);

            if (!XamlDecorationLayer.IsStrokeBrushExplicitlySet(this.verticalGridLineBorder.Style))
            {
                this.verticalGridLineBorder.BorderBrush = this.Owner.GridLinesBrush;
            }

            if (this.verticalGridLineBorder.BorderBrush != null && !XamlDecorationLayer.IsStrokeThicknessExplicitlySet(this.verticalGridLineBorder.Style))
            {
                this.verticalGridLineBorder.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
            }

            RadRect layoutSlot = verticalLine.layoutSlot;

            XamlMultiDayViewLayer.ArrangeUIElement(this.verticalGridLineBorder, layoutSlot, true);
        }
        internal void UpdateCurrentTimeIndicator()
        {
            CalendarModel    model = this.Owner.Model;
            CalendarGridLine currentTimeIndicator = model.CurrentTimeIndicator;

            if (currentTimeIndicator != null)
            {
                if (this.viewPortArea.IntersectsWith(currentTimeIndicator.layoutSlot) && currentTimeIndicator.layoutSlot.IsSizeValid())
                {
                    if (this.currentTimeIndicatorBorder == null)
                    {
                        this.currentTimeIndicatorBorder = new Border();
                        this.AddVisualChild(this.currentTimeIndicatorBorder);
                        Canvas.SetZIndex(this.currentTimeIndicatorBorder, XamlMultiDayViewLayer.DefaultCurrentTimeIndicatorZIndex);
                    }
                    else if (this.currentTimeIndicatorBorder.Visibility == Visibility.Collapsed)
                    {
                        this.currentTimeIndicatorBorder.Visibility = Visibility.Visible;
                        Canvas.SetZIndex(this.currentTimeIndicatorBorder, XamlMultiDayViewLayer.DefaultCurrentTimeIndicatorZIndex);
                    }

                    MultiDayViewSettings settings   = model.multiDayViewSettings;
                    Style currentTimeIndicatorStyle = settings.CurrentTimeIndicatorStyle ?? settings.defaultCurrentTimeIndicatorStyle;
                    if (currentTimeIndicatorStyle != null)
                    {
                        this.currentTimeIndicatorBorder.Style = currentTimeIndicatorStyle;
                    }

                    XamlMultiDayViewLayer.ArrangeUIElement(this.currentTimeIndicatorBorder, currentTimeIndicator.layoutSlot);
                    Canvas.SetLeft(this.currentTimeIndicatorBorder, -this.leftOffset);
                }
                else if (this.currentTimeIndicatorBorder?.Visibility == Visibility.Visible)
                {
                    this.currentTimeIndicatorBorder.Visibility = Visibility.Collapsed;
                    this.currentTimeIndicatorBorder.ClearValue(Canvas.ZIndexProperty);
                    this.currentTimeIndicatorBorder.ClearValue(Border.StyleProperty);
                }
            }
        }
        internal void UpdateTodaySlot()
        {
            Slot todaySlot = this.Owner.Model.multiDayViewModel.todaySlot;

            if (this.todaySlotBorder == null)
            {
                this.todaySlotBorder = new Border();
                this.contentPanel.Children.Add(this.todaySlotBorder);
            }
            else
            {
                this.todaySlotBorder.ClearValue(Border.VisibilityProperty);
                this.todaySlotBorder.ClearValue(Border.StyleProperty);
                this.todaySlotBorder.ClearValue(Canvas.ZIndexProperty);
                this.todaySlotBorder.ClearValue(Canvas.LeftProperty);
            }

            if (this.bufferedViewPortArea.IntersectsWith(todaySlot.layoutSlot))
            {
                MultiDayViewSettings settings = this.Owner.MultiDayViewSettings;
                Style todaySlotStyle          = settings.TodaySlotStyle ?? settings.defaulTodaySlotStyle;
                if (todaySlotStyle != null)
                {
                    this.todaySlotBorder.Style = todaySlotStyle;
                }

                RadRect layoutSlot = todaySlot.layoutSlot;
                XamlMultiDayViewLayer.ArrangeUIElement(this.todaySlotBorder, layoutSlot, true);

                Canvas.SetZIndex(this.todaySlotBorder, XamlMultiDayViewLayer.DefaultTodaySlotZIndex);
                Canvas.SetLeft(this.todaySlotBorder, layoutSlot.X - this.leftOffset + this.leftHeaderPanel.Width);
            }
            else if (this.todaySlotBorder.Visibility == Visibility.Visible)
            {
                this.todaySlotBorder.Visibility = Visibility.Collapsed;
            }
        }