This is a migrated thread and some comments may be shown as answers.

Difficulty replicating timeline sample...

5 Answers 89 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 07 Dec 2011, 05:03 PM
I want to relipcate the look and feel of the timeline controls as shown in this section of the product documentations...

http://www.telerik.com/products/winforms/scheduler.aspx#custom-resources-and-resource-grouping

However, using the examples on how to load data in when grouping by resources, but editing it so I can get it working as I want, it fails to load. I have been through my code and can't see anything wrong with however?

If someone can let me have a working sample of how to layout the schedule as shown in the example above, or point out where I'm going wrong, I'd be really grateful!


Schedule.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Timeline;
Schedule.GetTimelineView().ResourcesPerView = 8;
Schedule.GroupType = GroupType.Resource;
  
SchedulerDayViewGroupedByResourceElement headerElement = Schedule.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
Resource resource;
resource = new Resource();
resource.Id = new EventId("AC00-1");
resource.Name = "AC00-1";
resource.Color = Color.Beige;
Schedule.Resources.Add(resource);
resource = new Resource();
resource.Id = new EventId("AC00-2");
resource.Name = "AC00-2";
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
resource = new Resource();
resource.Id = new EventId("AC00-3");
resource.Name = "AC00-3";
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
Schedule.Appointments.BeginUpdate();
Appointment appointment;
appointment = new Appointment(new DateTime(2011, 12, 07, 12, 00, 00), new DateTime(2011, 12, 09, 12, 00, 00), "Summary", "Descriptions", "Location");
appointment.ResourceId = this.Schedule.Resources[0].Id;
appointment.BackgroundId = (int)AppointmentBackground.Important;
appointment.ToolTipText = "This is my custom Tooltip";
Schedule.Appointments.Add(appointment);

5 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 08 Dec 2011, 03:02 PM
Hello Karl,

Thank you for contacting us.

The issue is that you are setting the GroupType property when resources have not yet been added to RadScheduler. If you set this property after filling the Resources collection, the code you have provided works fine. Also, the ResourcesPerView property indicates how many resources should be visible at a time in the current view, so you should not set this with a value larger than the resources quantity:
Schedule.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Timeline;
SchedulerDayViewGroupedByResourceElement headerElement = Schedule.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
Resource resource;
resource = new Resource();
resource.Id = new EventId("AC00-1");
resource.Name = "AC00-1";
resource.Color = Color.Beige;
Schedule.Resources.Add(resource);
resource = new Resource();
resource.Id = new EventId("AC00-2");
resource.Name = "AC00-2";
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
resource = new Resource();
resource.Id = new EventId("AC00-3");
resource.Name = "AC00-3";
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
Schedule.Appointments.BeginUpdate();
Appointment appointment;
appointment = new Appointment(new DateTime(2011, 12, 07, 12, 00, 00), new DateTime(2011, 12, 09, 12, 00, 00), "Summary", "Descriptions", "Location");
appointment.ResourceId = this.Schedule.Resources[0].Id;
appointment.BackgroundId = (int)AppointmentBackground.Important;
appointment.ToolTipText = "This is my custom Tooltip";
Schedule.Appointments.Add(appointment);
 
Schedule.GroupType = GroupType.Resource;
Schedule.GetTimelineView().ResourcesPerView = 3;

I hope this is helpful. Should you need further help, do not hesitate to contact us.

All the best,
Ivan Todorov
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Karl
Top achievements
Rank 1
answered on 08 Dec 2011, 03:44 PM
Hi Ivan,

Thanks for your response, it's almost looking like I want it now.

However, in the example, the resources are on the left with the timeline across the top... How do I accomplish this? I really do want a similar look to my timeline (days across top and resources down the side)

Thanks again,
Karl
0
Karl
Top achievements
Rank 1
answered on 08 Dec 2011, 05:46 PM
Just to clarify, I have attached 2 images, WhatIHave.jpg and WhatIWant.jpg

As you can see, WhatIWant.jpg has the resources down the left hand side but I cannot get mine to show here correctly...
0
Karl
Top achievements
Rank 1
answered on 09 Dec 2011, 03:48 PM
I have just downloaded the latest version of the win controls (2011.3.11.1116) and followed the sample for the scheduler (timeline grouping) and it seems to be working now.

I'm not sure why this would have not worked before as the code is basically the same, but for now it's all working as I'd like.

0
Accepted
Ivan Todorov
Telerik team
answered on 13 Dec 2011, 12:35 PM
Hi Karl,

I am glad that you've had this sorted out.

For your information , the screenshots you have posted show two different views. The WhatIWant.jpg shows a  timeline view and the WhatIHave.jpg shows a day view. This means that for some reason your setting of the ActiveViewType property was ignored. I am not sure which version you were using at first. This might had been an issue that was fixed later.

If you need any future help, do not hesitate to contact us.

Greetings,
Ivan Todorov
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Karl
Top achievements
Rank 1
Share this question
or