Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics
AddHandler Me.ultraTimeLineView1.DateNavigationButtonClicked, AddressOf Me.OnDateNavigationButtonClicked
Private Sub OnDateNavigationButtonClicked(ByVal sender As Object, ByVal e As DateNavigationButtonClickedEventArgs)
Dim control As UltraTimelineView = sender
Dim timeInterval As TimeInterval = e.DateTimeInterval
If Not timeInterval Is Nothing AndAlso _
timeInterval.DateNavigationButtonActionResolved = TimelineViewDateNavigationButtonAction.None Then
Dim tzi As TimeZoneInfo = timeInterval.TimeZone
If Not tzi Is Nothing AndAlso Not TimeZoneInfo.CurrentTimeZone Is Nothing Then
' Get the StartDateTime from the DateRange, which will
' contain the local time for that TimeZone.
Dim nextDate As DateTime = e.DateTimeRange.StartDateTime
' Convert the local time for that TimeZone into local time
' for the current time zone
nextDate = New DateTime(nextDate.Ticks, DateTimeKind.Local)
Dim utc As DateTime = nextDate.Add(tzi.UtcOffset)
If (tzi.IsDaylightSavingTime(utc)) Then
utc = utc.Add(tzi.DaylightUtcOffset)
nextDate = TimeZoneInfo.CurrentTimeZone.ToLocalTime(utc, DateTimeKind.Utc)
' Get the next/previous date depending on the navigation direction.
Dim forward As Boolean = IIf(e.NavigationDirection = DateNavigationDirection.Forward, True, False)
nextDate = timeInterval.GetNextDate(nextDate, forward)
' Call EnsureDateTimeVisible to navigate to the date
control.EnsureDateTimeVisible(nextDate, forward = False)
End If
End If
End If
End Sub