バージョン

AdditionalIntervals プロパティ

PrimaryIntervalの上に表示される日付または時刻の間隔を定義する DateTimeInterval 派生インスタンスのコレクションを返します。
シンタックス
'宣言
 
Public ReadOnly Property AdditionalIntervals As DateTimeIntervalsCollection
public DateTimeIntervalsCollection AdditionalIntervals {get;}
解説

PrimaryInterval はアクティビティが表示される領域によってタイム スケールを定義します。AdditionalIntervals コレクションを移植することによって、任意の期間 (1 分以上の期間) の追加の間隔を定義できます。この追加の間隔はこれらの期間より短い間隔をフループ化します。追加の日付/時刻の間隔を表すヘッダーにスクロール ボタンを表示できます。この間隔によってタイムラインを前方方向または後方方向へナビゲートができます。

AdditionalIntervals コレクションに 1 つの項目が存在する場合は、複数の日付/時刻の間隔を表示します。期間の降順に上から下へに表示します。長い期間の時間の間隔が短い期間の時間の間隔の上に表示します。2 つ以上の DateTimeIntervals の期間が一致する場合は、コレクション内の順序位置は位置を決定します (小さいインデックスによって TimeInterval を下へ位置します)。

注: PrimaryInterval に生成されるサイクルの期間より短いサイクルを生成する DateTimeIntervals を表示します。コントロールは、各要素の NormalSpan プロパティに及ばれる期間を比較することによって DateTimeIntervals に生成されたサイクルの期間を比較します。PrimaryInterval のサイクルと同じ期間があるサイクルを生成した DateTimeIntervals を表示できますが、サイクルが PrimaryInterval のサイクルより短い DateTimeIntervals を表示しません。

たとえば、PrimaryInterval は 1 日の期間のサイクルを定義し、開発者は日を月の間隔によってグループ化をする希望がある場合は、AdditionaIntervals を使用します。これをするために、IntervalUnits プロパティが Monthly に設定される DateInterval インスタンスを AdditionalIntervals コレクションに追加します。PrimaryInterval を表す行の上に列ヘッダーの追加の行を表示します。この追加の行の各ヘッダーは年の月に相対し、第一の時間の間隔ヘッダーによって 28、29、30 または 31 日 (年と月に基づき) をスパンします (年と月によって)。

PrimaryInterval と実際に表示される AdditionalIntervals のメンバーのコレクションは、VisibleIntervals コレクションを介して使用できます。コントロールに表示されるコレクションのメンバーの順序。コレクションの最初のメンバーは一番上の間隔、PrimaryInterval は最後の間隔です。

使用例
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 );
}
参照