RadSchedule All Day Header Height getting reset

3 posts, 0 answers
  1. Brian
    Brian avatar
    2 posts
    Member since:
    Oct 2011

    Posted 09 Sep Link to this post

    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. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 14 Sep Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Brian
    Brian avatar
    2 posts
    Member since:
    Oct 2011

    Posted 14 Sep Link to this post

    Thank You, All is working as expected now.
Back to Top