Version

AdditionalIntervals Property

Returns a collection of DateTimeInterval-derived instances which define the date or time intervals that appear above the PrimaryInterval.
Syntax
'Declaration
 
Public ReadOnly Property AdditionalIntervals As DateTimeIntervalsCollection
public DateTimeIntervalsCollection AdditionalIntervals {get;}
Remarks

The PrimaryInterval defines the time scale for the area in which activities are displayed. The AdditionalIntervals collection can be populated to define additional intervals of any length of time, one minute or greater in duration, that essentially group intervals of shorter duration. Scroll buttons can be made to appear on the header which represents an additional date/time interval, which provide a means by which to navigate forward and backward along the timeline by that interval.

When one or more members exist in the AdditionalIntervals collection, multiple date/time intervals are displayed. They appear from top to bottom in order of descending duration, i.e., the time intervals with longer durations appear above those whose duration is shorter. When two or more DateTimeIntervals are identical in duration, their ordinal position within the collection determines their placement (a smaller index places a TimeInterval closer to the bottom).

Note: DateTimeIntervals that generate cycles which are shorter in duration that those generated by the PrimaryInterval are not displayed. The control compares the duration of the cycles generated by DateTimeIntervals by comparing the length of time spanned by the each one's NormalSpan property. DateTimeIntervals whose cycles are identical in duration to that of the PrimaryInterval can be displayed, but those whose cycles are shorter cannot.

An simple example of the usage of the AdditionalIntervals collection would be the case where the PrimaryInterval defines a cycle that is one day in duration, and the developer wants to group the days in monthly intervals. To achieve this, a DateInterval instance would be added to the AdditionalIntervals collection, with a value of 'Monthly' specified for its IntervalUnits property. This would cause an additional row of column headers to appear above the row that represents the PrimaryInterval; each header in this additional row would correspond to a month in the year, and would span across 28, 30, or 31 of the primary time interval headers ( which represent days), depending on the particular month and year with which that header was associated.

A collection of the members of the AdditionalIntervals collection that are actually displayed, along with the PrimaryInterval, is available via the VisibleIntervals collection. The order in which the members of this collection occur correspond to the order in which they appear in the control, with the topmost interval as the first member of the collection, and the PrimaryInterval as the last.

Example
The following code sample demonstrates how to use the properties of the DateTimeInterval class, and the derived classes TimeInterval and DateTinterval, to customize the appearance and behavior of the PrimaryInterval and the members of the AdditionalIntervals collection.

Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

Public Sub InitDateTimeIntervals(ByVal control As UltraTimelineView)

    '  Remove all additional intervals
    control.AdditionalIntervals.Clear()

    '  Get the current culture's date/time format info
    Dim formatInfo As System.Globalization.DateTimeFormatInfo = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat

    '  Create a monthly interval set its header format to the YearMonthPattern
    '  for the current culture so that the year is displayed along with the month name.
    Dim monthInterval As DateInterval = New DateInterval(1, DateIntervalUnits.Months)
    monthInterval.HeaderTextFormat = formatInfo.YearMonthPattern

    '  Create a bi-weekly interval use the 'RangeStart' HeaderTextFormatStyle,
    '  and customize the format so it shows as a pay period. Also, set its
    '  SynchronizingDate property to the first Monday of the year so that the
    '  cycles begin on a Monday.
    Dim biWeeklyInterval As DateInterval = New DateInterval(2, DateIntervalUnits.Weeks)
    biWeeklyInterval.HeaderTextFormatStyle = TimelineViewHeaderTextFormatStyle.RangeStart
    biWeeklyInterval.HeaderTextFormat = String.Format("\P\a\y \P\e\r\i\o\d: {0}", formatInfo.MonthDayPattern)
    biWeeklyInterval.SynchronizingDate = New DateTime(2009, 1, 5)

    '  Create a daily interval since we already have the year showing,
    '  we can set the format to only display the name of the day of the week.
    Dim dayInterval As DateInterval = New DateInterval(1, DateIntervalUnits.Days)
    dayInterval.HeaderTextFormat = "dddd"

    '  Create 1-hour TimeIntervals for some of the different U.S. time zones
    Dim tzHawaii As TimeZoneInfo = TimeZoneInfo.FromStandardName("Hawaiian Standard Time", False)
    If Not tzHawaii Is Nothing Then

      Dim hawaii As New TimeInterval(1, TimeIntervalUnits.Hours)
      hawaii.TimeZone = tzHawaii
      hawaii.LabelText = "Hawaii"
      hawaii.LabelToolTipText = tzHawaii.DisplayName

      '  Use the colors of the Hawaii state flag to style the appearance
      hawaii.HeaderAppearance.BackGradientStyle = GradientStyle.None
      hawaii.HeaderAppearance.ForeColor = Color.Red
      hawaii.HeaderAppearance.BackColor = Color.White
      hawaii.HeaderAppearance.BorderColor = Color.Black
      hawaii.LabelAppearance.BackColor = Color.White
      hawaii.DateNavigationButtonAppearance.ForeColor = Color.Red
      hawaii.DateNavigationButtonAppearance.BorderColor = Color.Navy

      '   Set DateNavigationButtonVisibility to 'ShowOnFirstAndLastHeader', and set
      '   DateNavigationButtonAction to 'None'
      hawaii.DateNavigationButtonVisibility = TimelineViewDateNavigationButtonVisibility.ShowOnFirstAndLastHeader
      hawaii.DateNavigationButtonAction = TimelineViewDateNavigationButtonAction.None

      '  Add it to the AdditionalIntervals collection
      control.AdditionalIntervals.Add(hawaii)
    End If


    Dim tzAlaska As TimeZoneInfo = TimeZoneInfo.FromStandardName("Alaskan Standard Time", False)
    If Not tzAlaska Is Nothing Then

      Dim alaska As TimeInterval = New TimeInterval(1, TimeIntervalUnits.Hours)
      alaska.TimeZone = tzAlaska
      alaska.LabelText = "Alaska"
      alaska.LabelToolTipText = tzAlaska.DisplayName

      '  Use the colors of the Alaska state flag to style the appearance
      alaska.HeaderAppearance.BackGradientStyle = GradientStyle.None
      alaska.HeaderAppearance.ForeColor = Color.Goldenrod
      alaska.HeaderAppearance.BackColor = Color.CornflowerBlue
      alaska.HeaderAppearance.BorderColor = Color.Black
      alaska.LabelAppearance.BackColor = Color.CornflowerBlue
      alaska.DateNavigationButtonAppearance.ForeColor = Color.Goldenrod
      alaska.DateNavigationButtonAppearance.BorderColor = Color.Black

      '   Set DateNavigationButtonVisibility to 'ShowOnFirstAndLastHeader', and set
      '   DateNavigationButtonAction to 'None'
      alaska.DateNavigationButtonVisibility = TimelineViewDateNavigationButtonVisibility.ShowOnFirstAndLastHeader
      alaska.DateNavigationButtonAction = TimelineViewDateNavigationButtonAction.None

      '  Add it to the AdditionalIntervals collection
      control.AdditionalIntervals.Add(alaska)
    End If

    '  Handle the DateNavigationButtonClicked event so we can customize
    '  the navigation for the Alaska and Hawaii intervals.
    AddHandler control.DateNavigationButtonClicked, AddressOf Me.OnDateNavigationButtonClicked

    '  Create a 30-minute TimeInterval that will be used as the PrimaryInterval;
    '  Since we have other time zones showing, show the current time zone's name
    '  in the tooltip.
    Dim primaryInterval As TimeInterval = New TimeInterval(30, TimeIntervalUnits.Minutes)
    Dim tzCurrent As TimeZoneInfo = TimeZoneInfo.CurrentTimeZone
    If Not tzCurrent Is Nothing Then

      Dim standardName As String = tzCurrent.StandardName
      Dim acronym As String = standardName

      '  Build an acronym from the standard name and assign that
      '  string value to the LabelText property
      Dim split As String() = standardName.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
      If (Split.Length > 1) Then
        acronym = String.Empty
        For Each s As String In split
          acronym += s(0)
        Next
      End If

      primaryInterval.LabelText = acronym
      primaryInterval.LabelToolTipText = standardName

      '  Set some appearance properties
      primaryInterval.HeaderAppearance.BackGradientStyle = GradientStyle.None
      primaryInterval.HeaderAppearance.ForeColor = SystemColors.ControlDark
      primaryInterval.HeaderAppearance.BackColor = SystemColors.Control
      primaryInterval.HeaderAppearance.BorderColor = SystemColors.ControlDarkDark
      primaryInterval.LabelAppearance.BackColor = SystemColors.Control
    End If

    '  Assign the TimeInterval to the PrimaryInterval property
    control.PrimaryInterval = primaryInterval

    '  Add each interval we created to the AdditionalIntervals collection
    control.AdditionalIntervals.Add(monthInterval)
    control.AdditionalIntervals.Add(biWeeklyInterval)
    control.AdditionalIntervals.Add(dayInterval)
End Sub
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

public void InitDateTimeIntervals( UltraTimelineView control )
{
    //  Remove all additional intervals
    control.AdditionalIntervals.Clear();

    //  Get the current culture's date/time format info
    System.Globalization.DateTimeFormatInfo formatInfo = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat;

    //  Create a monthly interval; set its header format to the YearMonthPattern
    //  for the current culture so that the year is displayed along with the month name.
    DateInterval monthInterval = new DateInterval( 1, DateIntervalUnits.Months );
    monthInterval.HeaderTextFormat = formatInfo.YearMonthPattern;

    //  Create a bi-weekly interval; use the 'RangeStart' HeaderTextFormatStyle,
    //  and customize the format so it shows as a pay period. Also, set its
    //  SynchronizingDate property to the first Monday of the year so that the
    //  cycles begin on a Monday.
    DateInterval biWeeklyInterval = new DateInterval( 2, DateIntervalUnits.Weeks );
    biWeeklyInterval.HeaderTextFormatStyle = TimelineViewHeaderTextFormatStyle.RangeStart;
    biWeeklyInterval.HeaderTextFormat = string.Format("\\P\\a\\y \\P\\e\\r\\i\\o\\d: {0}", formatInfo.MonthDayPattern);
    biWeeklyInterval.SynchronizingDate = new DateTime(2009, 1, 5 );

    //  Create a daily interval; since we already have the year showing,
    //  we can set the format to only display the name of the day of the week.
    DateInterval dayInterval = new DateInterval( 1, DateIntervalUnits.Days );
    dayInterval.HeaderTextFormat = "dddd";

    //  Create 1-hour TimeIntervals for some of the different U.S. time zones
    TimeZoneInfo tzHawaii = TimeZoneInfo.FromStandardName( "Hawaiian Standard Time", false );
    if ( tzHawaii != null )
    {
        TimeInterval hawaii = new TimeInterval( 1, TimeIntervalUnits.Hours );
        hawaii.TimeZone = tzHawaii;
        hawaii.LabelText = "Hawaii";
        hawaii.LabelToolTipText = tzHawaii.DisplayName;

        //  Use the colors of the Hawaii state flag to style the appearance
        hawaii.HeaderAppearance.BackGradientStyle = GradientStyle.None;
        hawaii.HeaderAppearance.ForeColor = Color.Red;
        hawaii.HeaderAppearance.BackColor = Color.White;
        hawaii.HeaderAppearance.BorderColor = Color.Black;
        hawaii.LabelAppearance.BackColor = Color.White;
        hawaii.DateNavigationButtonAppearance.ForeColor = Color.Red;
        hawaii.DateNavigationButtonAppearance.BorderColor = Color.Navy;

        //   Set DateNavigationButtonVisibility to 'ShowOnFirstAndLastHeader', and set
        //   DateNavigationButtonAction to 'None'
        hawaii.DateNavigationButtonVisibility = TimelineViewDateNavigationButtonVisibility.ShowOnFirstAndLastHeader;
        hawaii.DateNavigationButtonAction = TimelineViewDateNavigationButtonAction.None;

        //  Add it to the AdditionalIntervals collection
        control.AdditionalIntervals.Add( hawaii );
    }

    TimeZoneInfo tzAlaska = TimeZoneInfo.FromStandardName( "Alaskan Standard Time", false );
    if ( tzAlaska != null )
    {
        TimeInterval alaska = new TimeInterval( 1, TimeIntervalUnits.Hours );
        alaska.TimeZone = tzAlaska;
        alaska.LabelText = "Alaska";
        alaska.LabelToolTipText = tzAlaska.DisplayName;

        //  Use the colors of the Alaska state flag to style the appearance
        alaska.HeaderAppearance.BackGradientStyle = GradientStyle.None;
        alaska.HeaderAppearance.ForeColor = Color.Goldenrod;
        alaska.HeaderAppearance.BackColor = Color.CornflowerBlue;
        alaska.HeaderAppearance.BorderColor = Color.Black;
        alaska.LabelAppearance.BackColor = Color.CornflowerBlue;
        alaska.DateNavigationButtonAppearance.ForeColor = Color.Goldenrod;
        alaska.DateNavigationButtonAppearance.BorderColor = Color.Black;

        //   Set DateNavigationButtonVisibility to 'ShowOnFirstAndLastHeader', and set
        //   DateNavigationButtonAction to 'None'.
        alaska.DateNavigationButtonVisibility = TimelineViewDateNavigationButtonVisibility.ShowOnFirstAndLastHeader;
        alaska.DateNavigationButtonAction = TimelineViewDateNavigationButtonAction.None;

        //  Add it to the AdditionalIntervals collection
        control.AdditionalIntervals.Add( alaska );
    }

    //  Handle the DateNavigationButtonClicked event so we can customize
    //  the navigation for the Alaska and Hawaii intervals.
    control.DateNavigationButtonClicked += new DateNavigationButtonClickedHandler(OnDateNavigationButtonClicked);

    //  Create a 30-minute TimeInterval that will be used as the PrimaryInterval
    TimeInterval primaryInterval = new TimeInterval(30, TimeIntervalUnits.Minutes);
    TimeZoneInfo tzCurrent = TimeZoneInfo.CurrentTimeZone;
    if ( tzCurrent != null )
    {
        string standardName = tzCurrent.StandardName;
        string acronym = standardName;

        //  Build an acronym from the standard name and assign that
        //  string value to the LabelText property
        string[] split = standardName.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        if ( split.Length > 1 )
        {
            acronym = string.Empty;
            foreach( string s in split )
            {
                acronym += s[0];
            }
        }
        
        primaryInterval.LabelText = acronym;
        primaryInterval.LabelToolTipText = standardName;

        //  Set some appearance properties
        primaryInterval.HeaderAppearance.BackGradientStyle = GradientStyle.None;
        primaryInterval.HeaderAppearance.ForeColor = SystemColors.ControlDark;
        primaryInterval.HeaderAppearance.BackColor = SystemColors.Control;
        primaryInterval.HeaderAppearance.BorderColor = SystemColors.ControlDarkDark;
        primaryInterval.LabelAppearance.BackColor = SystemColors.Control;
    }

    //  Assign the TimeInterval to the PrimaryInterval property
    control.PrimaryInterval = primaryInterval;

    //  Add each interval we created to the AdditionalIntervals collection
    control.AdditionalIntervals.Add( monthInterval );
    control.AdditionalIntervals.Add( biWeeklyInterval );
    control.AdditionalIntervals.Add( dayInterval );
}
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