Ejemplo n.º 1
0
        protected override void SelectStyleCore(CalendarCellStyleContext context, RadCalendar container)
        {
            var scheduleViewModel = container.DataContext as ScheduleViewModel;

            if (scheduleViewModel != null)
            {
                var events = scheduleViewModel.CoursesScheduleList;
                switch (scheduleViewModel.DisplayMode)
                {
                case CalendarDisplayMode.MonthView:

                    if (events.Any(e => e.DateDebut <= context.Date && e.DateFin >= context.Date))
                    {
                        context.CellTemplate = this.EventTemplate;
                    }
                    break;

                case CalendarDisplayMode.YearView:
                    if (events.Any(e => (e.DateDebut.Month == context.Date.Month && e.DateDebut.Year == context.Date.Year) || (e.DateFin.Month == context.Date.Month && e.DateFin.Year == context.Date.Year)))
                    {
                        context.CellTemplate = this.EventTemplate;
                    }
                    break;

                default:
                    if (events.Any(e => e.DateDebut.Year == context.Date.Year || e.DateFin.Year == context.Date.Year))
                    {
                        context.CellTemplate = this.EventTemplate;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        protected override void SelectStyleCore(CalendarCellStyleContext context, RadCalendar container)
        {
            if (container.DisplayMode != CalendarDisplayMode.MonthView)
            {
                return;
            }

            var events = (container.DataContext as ExampleViewModel).Events;

            if (events.TryGetValue(context.Date, out this.eventsForDate))
            {
                bool appointmentEvent = context.Date.Day % 2 == 0;

                if (context.IsFromAnotherView)
                {
                    context.CellTemplate = appointmentEvent ? this.AnotherMonthAppointmentEvent : this.AnotherMonthEvent;
                }
                else if (!context.IsSelected)
                {
                    context.CellTemplate = appointmentEvent ? this.NormalAppointmentEvent : this.NormalEvent;
                }
                else if (context.IsSelected)
                {
                    context.CellTemplate = appointmentEvent ? this.SelectedAppointmentEvent : this.SelectedEvent;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void SelectStyleCore(CalendarCellStyleContext context, Telerik.UI.Xaml.Controls.Input.RadCalendar container)
        {
            var events = (container.DataContext as ViewModel).Events;

            if (events.Where(e => e.Date == context.Date).Count() > 0)
            {
                context.CellTemplate = this.EventTemplate;
            }
        }
        protected override void SelectStyleCore(CalendarCellStyleContext context, Telerik.UI.Xaml.Controls.Input.RadCalendar container)
        {
            var events = (container.DataContext as CortanaCalendarViewModel).CortanaAppointments;

            if (events.Where(e => e.StartDate.Date == context.Date.Date).Count() > 0)
            {
                context.CellTemplate = this.EventTemplate;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Evaluates the appearance settings to be applied on the respective calendar cell.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="container">The RadCalendar container.</param>
        public void SelectStyle(CalendarCellStyleContext context, RadCalendar container)
        {
            if (context == null || container == null)
            {
                return;
            }

            this.SelectStyleCore(context, container);
        }
        protected override void SelectStyleCore(CalendarCellStyleContext context, RadCalendar container)
        {
            ExampleViewModel  viewModel     = container.DataContext as ExampleViewModel;
            CalendarDateRange selectedRange = viewModel.SelectedRange;

            if ((context.Date < selectedRange.StartDate || context.Date > selectedRange.EndDate) || container.DisplayMode != CalendarDisplayMode.MonthView)
            {
                return;
            }

            context.CellStyle = container.SelectedCellStyle;
        }
 protected override void SelectStyleCore(CalendarCellStyleContext context, RadCalendar container) {
     if (context.IsBlackout && container.DisplayMode == CalendarDisplayMode.MonthView) {
         int position = allDangerDates.IndexOf(context.Date.ToString("MMMM dd, yyyy")) % 7;
         context.CellStyle = listCellStyle[position];
     } else {
         foreach (DateTime d in listBloodyDay) {
             if (context.Date.ToString("MMMM dd, yyyy").Equals(d.ToString("MMMM dd, yyyy"))) {
                 context.CellStyle = bloodyCellStyle;
             }
         }
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// When implemented by a derived class, provides a way to tap into the default calendar cell appearance logic through the passed
 /// <see cref="CalendarCellStyleContext" /> argument instance. For example you need to set the <see cref="CalendarCellStyleContext.CellStyle" /> or
 /// <see cref="CalendarCellStyleContext.CellTemplate" /> properties to customize / override the default appearance of the respective calendar cell.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="container">The RadCalendar container.</param>
 protected virtual void SelectStyleCore(CalendarCellStyleContext context, RadCalendar container)
 {
 }