private void ApplyStyleToCellDecorationVisual(Border visual, CalendarNode cell)
        {
            if (cell == null)
            {
                return;
            }

            Style cellStyle = cell.Context.GetEffectiveCellDecorationStyle();

            this.ApplyStyleToCellDecorationVisual(visual, cellStyle);
        }
        private void RecyclePrimaryVisual(CalendarNode node)
        {
            Border visual;

            if (this.realizedCalendarCellDecorationPresenters.TryGetValue(node, out visual))
            {
                this.realizedCalendarCellDecorationPresenters.Remove(node);

                this.RecyclePrimaryVisual(visual);
            }
        }
        internal static void PrepareDefaultVisualUno(Border visual, CalendarNode cell)
        {
            var textBlock = visual.Child as TextBlock;

            textBlock.Tag  = cell;
            textBlock.Text = cell.Label;

            ApplyStyleToDefaultVisual(textBlock, cell);

            MeasureVisual(visual);
        }
        private void PrepareDecorationVisual(Border visual, CalendarNode node, CalendarDecorationType decorationType)
        {
            visual.Tag = node;

            if (decorationType == CalendarDecorationType.GridLine)
            {
                visual.BorderBrush     = this.Owner.GridLinesBrush;
                visual.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
            }
            else
            {
                this.ApplyStyleToCellDecorationVisual(visual, node);
            }
        }
        internal static void ApplyStyleToDefaultVisual(TextBlock visual, CalendarNode cell)
        {
            if (cell.Context == null)
            {
                return;
            }

            Style cellStyle = cell.Context.GetEffectiveCellContentStyle();

            if (cellStyle == null)
            {
                return;
            }

            visual.Style = cellStyle;
        }
示例#6
0
        private void PrepareDecorationVisual(Border visual, CalendarNode node, CalendarDecorationType decorationType)
        {
            visual.Tag = node;

            if (decorationType == CalendarDecorationType.GridLine)
            {
                RadCalendar calendar = this.Owner;
                if (calendar.DisplayMode == CalendarDisplayMode.MultiDayView)
                {
                    MultiDayViewSettings settings = calendar.MultiDayViewSettings;
                    CalendarTimeRulerItemStyleSelector styleSelector = settings.TimeRulerItemStyleSelector ?? settings.defaultTimeRulerItemStyleSelector;
                    if (styleSelector != null)
                    {
                        Style style = styleSelector.SelectStyle(node, visual);
                        if (style != null)
                        {
                            visual.Style = style;

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

                            if (visual.BorderBrush != null && !XamlDecorationLayer.IsStrokeThicknessExplicitlySet(visual.Style))
                            {
                                visual.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
                            }
                        }
                        else
                        {
                            visual.BorderBrush     = this.Owner.GridLinesBrush;
                            visual.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
                        }
                    }
                }
                else
                {
                    visual.BorderBrush     = this.Owner.GridLinesBrush;
                    visual.BorderThickness = new Thickness(this.Owner.GridLinesThickness);
                }
            }
            else
            {
                this.ApplyStyleToCellDecorationVisual(visual, node);
            }
        }
示例#7
0
        private void SnapToBottomGridLine(CalendarNode calendarCell, int rowIndex)
        {
            if (rowIndex >= this.RowCount - 1 || rowIndex < 0)
            {
                return;
            }

            CalendarGridLine gridLine = this.GetDecorationByRowIndex(rowIndex + 1);

            if (!gridLine.layoutSlot.IsSizeValid())
            {
                return;
            }

            double difference = gridLine.layoutSlot.Y - calendarCell.layoutSlot.Bottom;

            calendarCell.layoutSlot.Height += difference;
        }
示例#8
0
        private void SnapToRightGridLine(CalendarNode calendarCell, int columnIndex)
        {
            if (columnIndex >= this.ColumnCount - 1 || columnIndex < 0)
            {
                return;
            }

            CalendarGridLine gridLine = this.GetDecorationByColumnIndex(columnIndex + 1);

            if (!gridLine.layoutSlot.IsSizeValid())
            {
                return;
            }

            double difference = gridLine.layoutSlot.X - calendarCell.layoutSlot.Right;

            calendarCell.layoutSlot.Width += difference;
        }
示例#9
0
        private void SnapToLeftGridLine(CalendarNode calendarCell, int columnIndex)
        {
            if (columnIndex <= 0 || columnIndex >= (this.ColumnCount + (this.BufferItemsCount * 2)))
            {
                return;
            }

            CalendarGridLine gridLine = this.GetDecorationByColumnIndex(columnIndex);

            if (!gridLine.layoutSlot.IsSizeValid())
            {
                return;
            }

            double difference = gridLine.layoutSlot.Right - calendarCell.layoutSlot.X;

            calendarCell.layoutSlot.X     += difference;
            calendarCell.layoutSlot.Width -= difference;
        }
示例#10
0
        private FrameworkElement GetDefaultVisual(CalendarNode cell, int virtualIndex)
        {
            TextBlock visual;

            if (virtualIndex < this.realizedCalendarCellDefaultPresenters.Count)
            {
                visual = this.realizedCalendarCellDefaultPresenters[virtualIndex];

                visual.ClearValue(TextBlock.VisibilityProperty);
                visual.ClearValue(TextBlock.StyleProperty);
            }
            else
            {
                visual = this.CreateDefaultVisual();
            }

            XamlContentLayerHelper.PrepareDefaultVisual(visual, cell);

            return(visual);
        }
        private FrameworkElement GetDefaultVisual(CalendarNode cell, int virtualIndex)
        {
#if NETFX_CORE
            TextBlock visual;

            if (virtualIndex < this.realizedCalendarCellDefaultPresenters.Count)
            {
                visual = this.realizedCalendarCellDefaultPresenters[virtualIndex];

                visual.ClearValue(TextBlock.VisibilityProperty);
                visual.ClearValue(TextBlock.StyleProperty);
            }
            else
            {
                visual = this.CreateDefaultVisual();
            }

            XamlContentLayerHelper.PrepareDefaultVisual(visual, cell);

            return(visual);
#else
            // TODO UNO
            DefaultPresenter visual;

            if (virtualIndex < this.realizedCalendarCellDefaultPresenters.Count)
            {
                visual = this.realizedCalendarCellDefaultPresenters[virtualIndex];

                visual.ClearValue(Border.VisibilityProperty);
                (visual.Child as TextBlock).ClearValue(TextBlock.StyleProperty);
            }
            else
            {
                visual = this.CreateDefaultVisual();
            }

            XamlContentLayerHelper.PrepareDefaultVisualUno(visual, cell);

            return(visual);
#endif
        }
示例#12
0
        private Border GetCalendarDecorationVisual(CalendarNode node, CalendarDecorationType decorationType)
        {
            Border visual;

            if (this.recycledContainers.Count > 0)
            {
                visual = this.recycledContainers.Dequeue();
                visual.ClearValue(Border.VisibilityProperty);

                this.realizedCalendarCellDecorationPresenters.Add(node, visual);
            }
            else
            {
                visual = this.CreateDecorationVisual();
                this.realizedCalendarCellDecorationPresenters.Add(node, visual);
            }

            this.PrepareDecorationVisual(visual, node, decorationType);

            return(visual);
        }
示例#13
0
        private static bool ShouldRenderPrimaryCellDecorationVisual(CalendarNode cell)
        {
            Style effectiveStyle = cell.Context.GetEffectiveCellDecorationStyle();

            return(effectiveStyle != null);
        }