Version

LogicalDayDuration Property

Gets/sets the maximum logical length of the day.
Syntax
'Declaration
 
Public Property LogicalDayDuration As TimeSpan
public TimeSpan LogicalDayDuration {get; set;}
Remarks

Typically, the length of a day is 24 hours; the LogicalDayDuration property makes it possible to shorten the logical length of the day.

The LogicalDayDuration property cannot be set to a value that is less than 1 minute or greater than 24 hours in duration; doing so will cause an exception to be thrown.

Example
The following code sample demonstrates how the LogicalDayOffset property can be used to create a "logical day" which begins at the current hour, and how the LogicalDayDuration property can be used to adjust the length of that logical day so that it ends at midnight of the following day.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim now As DateTime = DateTime.Now

        '	Create a TimeSpan that contains the same number of hours
        '	as the offset of the current time from midnight.
        Dim offset As TimeSpan = TimeSpan.FromHours(now.Hour)

        '	Create a TimeSpan that contains the number of hours remaining
        '	in the current day, including the current hour.
        Dim duration As TimeSpan = TimeSpan.FromHours((24 - now.Hour))

        '	Assign the offset to the UltraCalendarInfo's LogicalDayOffset
        '	property, so that the logical day begins on the current hour.
        Me.ultraCalendarInfo1.LogicalDayOffset = offset

        '	Assign the duration to the UltraCalendarInfo's LogicalDayDuration property,
        '	so that the logical day ends at midnight of the following day.
        Me.ultraCalendarInfo1.LogicalDayDuration = duration

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			DateTime now = DateTime.Now;

			//	Create a TimeSpan that contains the same number of hours
			//	as the offset of the current time from midnight.
			TimeSpan offset = TimeSpan.FromHours( (double)now.Hour );

			//	Create a TimeSpan that contains the number of hours remaining
			//	in the current day, including the current hour.
			TimeSpan duration = TimeSpan.FromHours( (double)(24 - now.Hour) );

			//	Assign the offset to the UltraCalendarInfo's LogicalDayOffset
			//	property, so that the logical day begins on the current hour.
			this.ultraCalendarInfo1.LogicalDayOffset = offset;

			//	Assign the duration to the UltraCalendarInfo's LogicalDayDuration property,
			//	so that the logical day ends at midnight of the following day.
			this.ultraCalendarInfo1.LogicalDayDuration = duration;			
		}
Requirements

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

See Also