Difficulty replicating timeline sample...

6 posts, 1 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 07 Dec 2011 Link to this post

    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);
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 08 Dec 2011 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2011 Link to this post

    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
  5. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2011 Link to this post

    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...
  6. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 09 Dec 2011 Link to this post

    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.

  7. Answer
    Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 13 Dec 2011 Link to this post

    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.

Back to Top
UI for WinForms is Visual Studio 2017 Ready