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

RadSchedule All Day Header Height getting reset

2 Answers 84 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 09 Sep 2016, 09:57 PM

With the GroupType set to Resource and the ActiveViewType set to Day I want the All Day Header Height to be set to 15. Everytime I set the height with the GroupType set to Resource it gets reset to the height of 25. As long as the GroupType is set to None the All Day Header Height gets set to the desired size. Here is the code I am currently using to set the height.

'Add any resources that aren't already in the collection
                    For Each nCrew In SelectedCrews
                        If IsNothing(nScheduler.Resources.GetById(nCrew.ID)) = True Then
                            nResource = New Telerik.WinControls.UI.Resource(New EventId(nCrew.ID), nCrew.Name)
                            nResource.Color = Color.Transparent
                            nScheduler.Resources.Add(nResource)
                            nScheduler.Resources.Item(nScheduler.Resources.Count - 1).SetDataItem(nCrew)
                        End If
                    Next nCrew
 
                    Dim nDayView As SchedulerDayView = nScheduler.GetDayView
                    If nDayView IsNot Nothing Then
                        nDayView.DayCount = 1
 
                        nDayView.ShowAllDayArea = True
                        nDayView.ShowHeader = False
 
                        'How many resource columns are displayed (cap at 7)
                        If nScheduler.Resources IsNot Nothing Then
                            If nScheduler.Resources.Count < 7 Then
                                nDayView.ResourcesPerView = nScheduler.Resources.Count
                            Else
                                nDayView.ResourcesPerView = 7
                            End If
                        Else
                            nDayView.ResourcesPerView = 7
                        End If
                    End If
 
                    nScheduler.GroupType = GroupType.Resource
 
                    Dim dayViewElement As SchedulerDayViewGroupedByResourceElement
 
                    If TypeOf nScheduler.SchedulerElement.ViewElement Is Telerik.WinControls.UI.SchedulerDayViewGroupedByResourceElement Then
                        dayViewElement = TryCast(nScheduler.SchedulerElement.ViewElement, Telerik.WinControls.UI.SchedulerDayViewGroupedByResourceElement)
                        If dayViewElement IsNot Nothing Then
                            dayViewElement.ResourceHeaderHeight = 25
                            dayViewElement.ResourcesHeader.Visibility = ElementVisibility.Visible
                            dayViewElement.AllDayHeaderHeight = 15
                        End If
                    End If
 
                    nScheduler.ResumeUpdate()
 
                    'Set up the Time Range on the Calendar
                    SetRuler(Me, nScheduler)

 

 

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Sep 2016, 06:47 AM
Hello Brian,

Thank you for writing.  

When you change the GroupType, the RadScheduler's view is reset. That is why it is necessary to set the AllDayHeaderHeight property of the respective element again. Here is a sample code snippet demonstrating how to do it:
Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
    If Me.RadScheduler1.GroupType = GroupType.Resource Then
        Me.RadScheduler1.GroupType = GroupType.None
    Else
        Me.RadScheduler1.GroupType = GroupType.Resource
    End If
    UpdateView()
End Sub
 
Private Sub UpdateView()
    Dim dayViewElement As SchedulerDayViewElement
    If Me.RadScheduler1.GroupType = GroupType.Resource Then
        Dim resourceElement As SchedulerDayViewGroupedByResourceElement = TryCast(Me.RadScheduler1.SchedulerElement.ViewElement,  _
            SchedulerDayViewGroupedByResourceElement)
        resourceElement.ResourceHeaderHeight = 50
        If TypeOf Me.RadScheduler1.SchedulerElement.ViewElement Is Telerik.WinControls.UI.SchedulerDayViewGroupedByResourceElement Then
            For Each el As RadElement In resourceElement.Children
                dayViewElement = TryCast(el, SchedulerDayViewElement)
                If dayViewElement IsNot Nothing Then
                    dayViewElement.AllDayHeaderHeight = 40
                End If
            Next
        End If
    Else
        dayViewElement = Me.RadScheduler1.ViewElement
        dayViewElement.AllDayHeaderHeight = 40
    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
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Brian
Top achievements
Rank 1
answered on 14 Sep 2016, 03:22 PM
Thank You, All is working as expected now.
Tags
Scheduler and Reminder
Asked by
Brian
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Brian
Top achievements
Rank 1
Share this question
or