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

Timeline - Appointment relative position when Grouping by resource

7 Answers 154 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Viet
Top achievements
Rank 1
Viet asked on 30 Oct 2015, 01:38 AM

I am working on the timeline of the Schedule control of UI for WinForms. My purpose is to show maximum number of resources and all of their appointments so that we do not need to scroll to see appointments of a resource.
In order to do that, I must have the information like shown in the screen shot attached. That is the number of appointment line inside each resource. Do we have this information somewhere inside the control? Or I must calculate it myself. What information can I base on in order to calculate that in both of the case radScheduler1.EnableExactTimeRendering is true or false?.

Do we have a method that can get the relative position of an AppointmentElement inside a resource in case grouping by resource?

Thanks.

7 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 02 Nov 2015, 07:16 AM
Hi Viet,

Thank you for writing.

The sizes of the resources are defined by their number and the available size in the view. RadScheduler provides an API for adjusting their sizes, however, please note that these calculations are relative. The responsible method is SetResourceSize and it requires a parameter as a proportion determining what part of the view will be occupied by the selected resource.

The following documentation article provides additional information: Grouping by Resources. I am also attaching a demo project and a gif file showing how RadScheduler looked on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Viet
Top achievements
Rank 1
answered on 05 Nov 2015, 05:55 AM

Hi Hristo,

I am afraid this hasn't answered my question. I would like to have a way to know the number of lines of appointments that need to be displayed in the timeline view of each resource. With this information, I can adjust the height of each resource accordingly so that my user doesn't need to scroll to be able to see all of a resource's appointments.

I had described this on the screenshot attached in the beginning of the post. Please have a look.

Thanks.

0
Hristo
Telerik team
answered on 05 Nov 2015, 02:26 PM
Hello Viet,

Thank you for writing.

The project I last sent you includes an example how you can extract a resource from a cell. Then knowing the resource you can find the unique appointments associated to it: 
IResource cellResource = this.radScheduler1.SelectionBehavior.CurrentCellElement.View.GetResource();
List<IEvent> appointments = this.radScheduler1.Appointments.Where(a => a.ResourceId == cellResource.Id).ToList();

Then, knowing their count you can perform further calculations and adjust the resource size as shown in the previously attached project.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Viet
Top achievements
Rank 1
answered on 06 Nov 2015, 06:14 AM

Hi Hristo,

My question is how I can calculate the size needed for each resource from the list of appointments so that I can adjust it?

As you can see, in the timeline, the control automatically align overlapped appointments into appointment lines.

Thanks.

0
Hristo
Telerik team
answered on 09 Nov 2015, 06:10 AM
Hello Viet,

Thank you for writing back.

You can get the maximums of all the scroll bars of the resources and then knowing the ratio between the different groups you can adjust a particular resource or all of them. Please check my snippet below:
List<int> scrollMax;
private void radScheduler1_ActiveViewChanged(object sender, SchedulerViewChangedEventArgs e)
{
    if (e.NewView is SchedulerTimelineView)
    {
        TimelineGroupingByResourcesElement groupedTimelineViewElement = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement;
        if (groupedTimelineViewElement != null)
        {
            IList<SchedulerTimelineViewElement> childViewElements = groupedTimelineViewElement.GetChildViewElements();
            this.scrollMax = new List<int>();
            for (int i = 0; i < childViewElements.Count; i++)
            {
                this.scrollMax.Add(childViewElements[i].VScrollBar.Maximum);
            }
        }
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Viet
Top achievements
Rank 1
answered on 09 Nov 2015, 09:49 AM

Hi Hristo,

I have tried your code snippet, but it seems not fit my need. Please have a look at the attached screen shot with my note in red inside.

I need a way to calculate the height of resouces that fit the needs of space to draw resources without having to scroll. Ofcource, if n resources are displayed, then we can adjust resource No.2 - No.n according to the resource No.1. I need a way to calculate the needed height of all of n resources so that I can display a number of resources that fit the screen height when user scroll the scheduler control.

Thanks.

0
Hristo
Telerik team
answered on 10 Nov 2015, 02:40 PM
Hi Viet,

Thank you for writing back.

I am not sure why the maximum value of the vertical scrollbar returns 100, it appears that it has remained with its default value. Now I am attaching my sample project as well as a gif file showing how the scheduler behaved on my end.

In case you are still experiencing issues please open up a support ticket referring this forum thread and attach your project so that I can test it locally.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler and Reminder
Asked by
Viet
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Viet
Top achievements
Rank 1
Share this question
or