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

Change appointment element height

13 Answers 261 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 24 Jul 2012, 03:43 PM
Is it possible to change the height of appointments in the schedulers timeline view?

Either a fixed size or a "fill" option - where the appointment would fill the day/resource cell- would be great. In the case of the fill option, multiple appointments would divide available space between them until such time as the text becomes unreadable, then they scroll.

If either of these options are possible, can someone please point me in the right direction so I can implement it on my control?

Thanks,
Karl

13 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 25 Jul 2012, 02:06 PM
Hello Karl,

Thank you for your question.

There is an AppointmentHeight property in the SchedulerTimelineViewElement which you can use to set fixed height for all appointments. You can set this property in the VisualStyleBuilder as it is demonstrated on the attached screenshot. In case you want to dynamically calculate the value of this property, you can also set it via the following code:
SchedulerTimelineViewElement timeline = this.radScheduler1.SchedulerElement.ViewElement as SchedulerTimelineViewElement;
if (timeline != null)
{
    timeline.AppointmentHeight = value;
}

I hope you find this useful. Feel free to ask if you have any additional questions.

Kind regards,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
David
Top achievements
Rank 1
answered on 17 Nov 2015, 02:50 PM

Is there a way to set the AppointmentHeight in GroupedByResource mode when in TimeLineView ?

Because when using the code above, SchedulerTimelineViewElement returns null.

Here's the code I'm using :


 

01.For i = 0 To pDataSetRessources.Count - 1
02.   Dim lMachine As New Resource()
03.   lMachine.Id = New EventId(pDataSetRessources.Item(i).Id)
04.   lMachine.Name = pDataSetRessources.Item(i).Nom
05.   lMachine.Color = If(i Mod 2 = 0, Color.White, Color.Gray)
06. 
07.   Me.RadScheduler_PlanningOf.Resources.Add(lMachine)
08.Next
09. 
10.RadScheduler_PlanningOf.GroupType = GroupType.Resource
11. 
12. 
13. 
14.Me.RadScheduler_PlanningOf.ActiveViewType = SchedulerViewType.Timeline
15. 
16.       
17.           Dim timelineViewElement As SchedulerTimelineViewElement = _
18.              TryCast(Me.RadScheduler_PlanningOf.SchedulerElement.ViewElement, _
19.                  SchedulerTimelineViewElement)
20.            
21.           If Not IsNothing(timelineViewElement) Then ' Returns nothing :'(
22.               'No Way
23.               timelineViewElement.AppointmentHeight = 200
24.               'If Only ...
25.               timelineViewElement.Presenter.AppointmentHeight = 200
26.           End If

 

 

P.S. I've seen there's classes dedicated to GroupedByResource that might help like
SchedulerDayViewGroupedByResourceElement > SchedulerDayViewElement
But no such class for TimeLineView

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Nov 2015, 09:42 AM
Hello David,

Thank you for writing.

Here is a sample code snippet demonstrating how to specify the AppointmentHeight property for each SchedulerTimelineViewElement associated with a resource: 
Sub New()
    InitializeComponent()
    Dim colors() As Color = {Color.LightBlue, Color.LightGreen, Color.LightYellow, Color.Red, Color.Orange}
    Dim names() As String = {"Alan Smith", "Anne Dodsworth", "Boyan Mastoni", "Richard Duncan", "Maria Shnaider"}
    For i As Integer = 0 To names.Length - 1
        Dim resource As New Telerik.WinControls.UI.Resource()
        resource.Id = New EventId(i)
        resource.Name = names(i)
        resource.Color = colors(i)
        Me.RadScheduler1.Resources.Add(resource)
    Next i
    Me.RadScheduler1.GroupType = GroupType.Resource
    Me.RadScheduler1.ActiveView.ResourcesPerView = Me.RadScheduler1.Resources.Count
    Me.RadScheduler1.ActiveViewType = SchedulerViewType.Timeline
    Dim rand As New Random
    For index = 1 To 10
        Dim a As New Appointment(DateTime.Now.AddHours(index), TimeSpan.FromHours(2), "A" & index)
        a.ResourceId = Me.RadScheduler1.Resources(rand.Next(0, Me.RadScheduler1.Resources.Count)).Id
        Me.RadScheduler1.Appointments.Add(a)
    Next
 
    Dim timelineElement As TimelineGroupingByResourcesElement = TryCast(Me.RadScheduler1.SchedulerElement.ViewElement, TimelineGroupingByResourcesElement)
    For Each el As RadElement In timelineElement.Children
        Dim t As SchedulerTimelineViewElement = TryCast(el, SchedulerTimelineViewElement)
        If t IsNot Nothing Then
            t.AppointmentHeight = 50
        End If
    Next
End Sub

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
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
David
Top achievements
Rank 1
answered on 24 Nov 2015, 02:54 PM
It works perfectly, thanks a lot.
0
Andrzej
Top achievements
Rank 1
answered on 17 Mar 2017, 12:17 AM
It's possible to have different AppoitmentHeight for the same view ? In first group I want for example to have A2 with 50 points, A3 with 100 points, A4 with 75points of height etc.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Mar 2017, 12:04 PM
Hello Andrzej,

Thank you for writing.  

The AppointmentHeight property controls the height for all appointments into the view. However, if you need to achieve different height for the appointments, it is necessary to set the RadScheduler.AutoSizeAppointments property to true and handle the AppointmentFormatting event where you can specify the AppointmentElement.MinSize property. Here is a sample code snippet:
Me.RadScheduler1.AutoSizeAppointments = True

Private Sub AppointmentFormatting(sender As Object, e As SchedulerAppointmentEventArgs)
    If e.Appointment.Summary.Contains("1") Then
        e.AppointmentElement.MinSize = New Size(0, 150)
    Else
        e.AppointmentElement.MinSize = New Size(0, 50)
    End If
End Sub

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Andrzej
Top achievements
Rank 1
answered on 19 Mar 2017, 02:51 PM

Thanks :) It works exactly as I need. Now I can show in 2 ways time consumption by resources (for example field-workers).

1) in horizontal level -  Me.RadScheduler1.EnableExactTimeRendering = True

2) in vertical level - via formating height of appointment

Now RadScheduler shows power. I must try its performance with "big data" - 20/50k of records.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Mar 2017, 09:27 AM
Hello Andrzej, 

Thank you for writing back. 

I am glad that the provided solution suits your scenario. You can deal with a large number of appointments grouped by resources. Note that for a better visual representation and due to performance consideration it is recommended to show not all resources at a time by a subset of them by setting the RadScheduler.ActiveView.ResourcesPerView property to an appropriate value. Additional information about RadScheduler's resources is available in the following help article: http://docs.telerik.com/devtools/winforms/scheduler/views/grouping-by-resources

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Giovanni
Top achievements
Rank 1
answered on 15 Apr 2020, 08:48 AM

Hello, is it possible to change the resource color (in timeline view) avoiding the vertical gradient that's currently applied by default?

I would like to paint the resource background with the selected color without further styles.

Thank you,

Giovanni.

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Apr 2020, 01:45 PM
  

Hello, Giovanni,

Each Resource offers a Color property which controls what to be the color for it: 

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 new Resource(); 
                resource.Id = new EventId(i); 
                resource.Name = names[i]; 
                resource.Color = colors[i]; 
   
                this.radSchedulerDemo.Resources.Add(resource); 
            } 

Additional information about resources in available in the following help article: https://docs.telerik.com/devtools/winforms/controls/scheduler/appointments-and-dialogs/working-with-resources

I hope this information helps. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Giovanni
Top achievements
Rank 1
answered on 17 Apr 2020, 01:52 PM

Hello Dess, thank you for your reply, I'm currently using the properties you've mentioned above but the problem I'm facing is its rendering; Once I set a color, lets say Color.Orange, the control rendering event would output the requested color with a layered vertical gradient.

I would like to have the selected solid color.

Do you think it is possibile?

Giovanni.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Apr 2020, 02:03 PM

Hello, Giovanni,

The CellFormatting event allows you to customize the style of all cells in RadScheduler. It is just necessary to specify the GradientStyle to Solid for the SchedulerResourceHeaderCellElement. Please refer to the following help article for further rinformation about the styling options in the mentioned event : https://docs.telerik.com/devtools/winforms/controls/scheduler/appearance/formatting-cells

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Giovanni
Top achievements
Rank 1
answered on 17 Apr 2020, 02:15 PM

Thank you so much Dess! 

That's exactly what I was looking for! Now it works!

Cheers,

Giovanni

Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
David
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Andrzej
Top achievements
Rank 1
Giovanni
Top achievements
Rank 1
Share this question
or