Version

PrimaryInterval Property

Returns or sets the DateTimeInterval-derived instance which is represented in the bottom row of column headers, and which defines the smallest time interval in effect for the control.
Syntax
'Declaration
 
Public Property PrimaryInterval As DateTimeInterval
public DateTimeInterval PrimaryInterval {get; set;}
Remarks

The PrimaryInterval property defines the interval for the areas of the control in which activities are displayed. It is always displayed on the bottom row of column headers. The amount of time spanned by each time slot displayed by the control is determined by the PrimaryInterval.

While any of the members of the AdditionalIntervals collection can be hidden from the user interface, the headers generated by the PrimaryInterval are displayed at all times.

The PrimaryInterval property can be set to null, but the property will never return a null value, i.e., a default instance is maintained to ensure that at least one time interval is defined for the control at all times. This instance is of type TimeInterval, which generates cycles of fifteen minutes in duration.

When the PrimaryInterval property is assigned a new value, or the Interval (or IntervalUnits) property's value has changed, the PrimaryIntervalChanged event is fired, to give listeners an opportunity to react to the change. This can be used to, for example, synchronize the TimeSlotInterval property for an UltraDayView control that is associated with the same UltraCalendarInfo.

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