This is a migrated thread and some comments may be shown as answers.
Customizing the Timeline View
4 Answers 158 Views
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 2
Adam asked on 10 Nov 2010, 10:41 PM
I am looking to use the Timeline View with Resource Grouping to show a timeline of about three months, (from 2-weeks-ago to 2-months-from-now), all visible at once, and allow for scrolling beyond those visible limits.

It seems that, by default, the timeline shows only 7 days ahead of the StartDate which I have set to DateTime.Now.AddDays(-14) to set the first visible date back two weeks from today.  I would like to be able to set the number of visible days to ±70, (and eventually use a radtrackBar to dynamically change the number of visible days).

Aside from that, how would I set the width of the day 'columns' in the TimeLine?  Most of the appointments I will be adding to the scheduler will be several days, even weeks in duration and I will only require a month heading and a numerical day label.

Thanks,
Adam

4 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 11 Nov 2010, 11:52 PM
Hi Adam,

In order to change the number of visible days in the TimelineView isn't straightforward. This is controlled via the CurrentScale property of the TimeLineView which is, in this case a DayTimeScale. However, the CurrentScale property does not have a setter.

I have managed with the code below to change the value and it is reflected in the RadScheduler, but it only displays correctly after using the scrollbar to scroll the next section into view.

I will continue to have a look at a way to do this for you, but in the meantime, I thought this code may help you to get started.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.RadScheduler1.SchedulerElement.BeginElementUpdate()
    Dim timelineView As SchedulerTimelineView = Me.RadScheduler1.GetTimelineView()
    Dim dayScale As New DaytimeScale()
    dayScale.DisplayedCellsCount = 20
    Dim currentScaleProperty As PropertyInfo
    For Each p As PropertyInfo In GetType(Telerik.WinControls.UI.SchedulerTimelineView).GetProperties()
        If p.Name = "CurrentScale" Then
            currentScaleProperty = p
            Exit For
        End If
    Next
    currentScaleProperty.SetValue(timelineView, dayScale, Nothing)
    Me.RadScheduler1.SchedulerElement.EndElementUpdate()
End Sub

Perhaps there is an easier way. I will let you know as soon as possible.

Hope this helps
Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 12 Nov 2010, 12:49 AM
Hi Adam,

Ok, I have this working. I just changed the StartDate and that seems to cause teh required refresh. the final code has a navigator and can be seen in the screenshot attached.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.RadScheduler1.ActiveViewType = SchedulerViewType.Timeline
    Me.RadScheduler1.SchedulerElement.BeginElementUpdate()
    Dim timelineView As SchedulerTimelineView = Me.RadScheduler1.GetTimelineView()
    Dim dayScale As New DaytimeScale()
    dayScale.DisplayedCellsCount = 20
    Dim currentScaleProperty As PropertyInfo
    For Each p As PropertyInfo In GetType(Telerik.WinControls.UI.SchedulerTimelineView).GetProperties()
        If p.Name = "CurrentScale" Then
            currentScaleProperty = p
            Exit For
        End If
    Next
    currentScaleProperty.SetValue(timelineView, dayScale, Nothing)
    Me.RadScheduler1.SchedulerElement.EndElementUpdate()
    Me.RadSchedulerNavigator1.MonthViewButtonVisible = False
    Me.RadSchedulerNavigator1.WeekViewButtonVisible = False
    Me.RadSchedulerNavigator1.DayViewButtonVisible = False
    Me.RadSchedulerNavigator1.AssociatedScheduler = Me.RadScheduler1
    timelineView.StartDate = DateTime.Now.AddDays(1)
    timelineView.StartDate = DateTime.Now
End Sub

Hope this helps, but if you have any more questions, just let me know.
Richard
0
Dobry Zranchev
Telerik team
answered on 17 Nov 2010, 08:36 AM
Hi Adam,

You could update the number of displayed slots in the timeline view as it is shown below: 
this.radScheduler1.GroupType = GroupType.None;
this
.radScheduler1.GetTimelineView().GetTimescale(Timescales.Days).DisplayedCellsCount = 70;
this.radScheduler1.GroupType = GroupType.Resource;

If you have other questions, feel free to write us back.

Kind regards,
Dobry Zranchev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Richard Slade
Top achievements
Rank 2
answered on 17 Nov 2010, 08:38 AM
Hi Dobry,

It's that simple. I've learnt something new too. Thanks!
Richard
Asked by
Adam
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Dobry Zranchev
Telerik team
Share this question
or