Determines the action to be performed when a
DateNavigationButtonUIElement is clicked.
The following code sample demonstrates how to use the DateNavigationButtonClicked event to customize date navigation:
For an overview of how to handle events in Visual Basic or Visual C#, see
Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see
Consuming Events in the
.NET Framework Developer's Guide.
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
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;
this.ultraTimeLineView1.DateNavigationButtonClicked += new DateNavigationButtonClickedHandler(this.OnDateNavigationButtonClicked);
private void OnDateNavigationButtonClicked(object sender, DateNavigationButtonClickedEventArgs e)
{
UltraTimelineView control = sender as UltraTimelineView;
TimeInterval timeInterval = e.DateTimeInterval as TimeInterval;
if ( timeInterval != null &&
timeInterval.DateNavigationButtonActionResolved == TimelineViewDateNavigationButtonAction.None )
{
TimeZoneInfo tzi = timeInterval.TimeZone;
if ( tzi != null && TimeZoneInfo.CurrentTimeZone != null )
{
// Get the StartDateTime from the DateRange, which will
// contain the local time for that TimeZone.
DateTime next = e.DateTimeRange.StartDateTime;
// Convert the local time for that TimeZone into local time
// for the current time zone
next = new DateTime( next.Ticks, DateTimeKind.Local );
DateTime utc = next.Add( tzi.UtcOffset );
if ( tzi.IsDaylightSavingTime(utc) )
utc = utc.Add( tzi.DaylightUtcOffset );
next = TimeZoneInfo.CurrentTimeZone.ToLocalTime( utc, DateTimeKind.Utc );
// Get the next/previous date depending on the navigation direction.
bool forward = e.NavigationDirection == DateNavigationDirection.Forward;
next = timeInterval.GetNextDate( next, forward );
// Call EnsureDateTimeVisible to navigate to the date
control.EnsureDateTimeVisible( next, forward == false );
}
}
}
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2