private void InvalidateScheduler() { SchedulerDayViewGroupedByResourceElement dayView = this.radSchedulerDemo.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement; SchedulerMonthViewGroupedByResourceElement monthView = this.radSchedulerDemo.SchedulerElement.ViewElement as SchedulerMonthViewGroupedByResourceElement; TimelineGroupingByResourcesElement timelineElement = this.radSchedulerDemo.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement; if (dayView == null && monthView == null && timelineElement == null) { return; } int headerHeight = 135; if (dayView != null) { dayView.ResourceHeaderHeight = headerHeight; dayView.InvalidateMeasure(true); } else if (monthView != null) { monthView.ResourceHeaderHeight = headerHeight; } else if (timelineElement != null) { timelineElement.ResourceHeaderWidth = headerHeight; } this.radSchedulerDemo.PerformLayout(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); DateTime baseDate = DateTime.Today; DateTime[] start = new DateTime[] { baseDate.AddHours(14.0), baseDate.AddDays(1.0).AddHours(9.0), baseDate.AddDays(2.0).AddHours(13.0) }; DateTime[] end = new DateTime[] { baseDate.AddHours(16.0), baseDate.AddDays(1.0).AddHours(15.0), baseDate.AddDays(2.0).AddHours(17.0) }; string[] summaries = new string[] { "Mr. Brown", "Mr. White", "Mrs. Green" }; string[] descriptions = new string[] { "", "", "" }; string[] locations = new string[] { "City", "Out of town", "Service Center" }; AppointmentBackground[] backgrounds = new AppointmentBackground[] { AppointmentBackground.Business, AppointmentBackground.MustAttend, AppointmentBackground.Personal }; this.radSchedulerDemo.Appointments.BeginUpdate(); Appointment appointment = null; appointment = new Appointment(baseDate.AddHours(11.0), baseDate.AddHours(12.0), "Wash the car", "", "Garage"); appointment.RecurrenceRule = new DailyRecurrenceRule(baseDate.AddHours(11.0), 2); this.radSchedulerDemo.Appointments.Add(appointment); this.radSchedulerDemo.Appointments.EndUpdate(); Color[] colors = new Color[] { Color.LightBlue, Color.LightGreen, Color.LightYellow, Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue }; string[] names = new string[] { "Alan Smith", "Anne Dodsworth", "Boyan Mastoni", "Richard Duncan", "Maria Shnaider" }; for (int i = 0; i < names.Length; i++) { Resource resource = new Resource(); resource.Id = new EventId(i); resource.Name = names[i]; resource.Color = colors[i]; resource.Image = this.imageList1.Images[i]; this.radSchedulerDemo.Resources.Add(resource); } this.radSchedulerDemo.GetDayView().ResourcesPerView = 2; this.radSchedulerDemo.GroupType = GroupType.Resource; SchedulerDayViewGroupedByResourceElement headerElement = this.radSchedulerDemo.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement; headerElement.ResourceHeaderHeight = 135; for (int i = 0; i < summaries.Length; i++) { appointment = new Appointment(start[i], end[i], summaries[i], descriptions[i], locations[i]); appointment.ResourceId = this.radSchedulerDemo.Resources[0].Id; appointment.BackgroundId = (int)backgrounds[i]; this.radSchedulerDemo.Appointments.Add(appointment); } SchedulerDayViewGroupedByResourceElement dayView = this.radSchedulerDemo.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement; dayView.ScrollToWorkHours(); this.radSchedulerDemo.ActiveViewChanged += new EventHandler <SchedulerViewChangedEventArgs>(radSchedulerDemo_ActiveViewChanged); this.radSchedulerDemo.PropertyChanged += new PropertyChangedEventHandler(radSchedulerDemo_PropertyChanged); this.radSchedulerDemo.MouseDown += new MouseEventHandler(radSchedulerDemo_MouseDown); this.radSchedulerDemo.SchedulerElement.SetResourceHeaderAngleTransform(SchedulerViewType.Timeline, 0); this.radSchedulerNavigator1.AssociatedScheduler = this.radSchedulerDemo; }