VisibleWeek プロパティはランタイムに限って使用できます。
注: VisibleWeek プロパティは、UltraCalendarInfo オブジェクトの MinDate および MaxDate プロパティによって決定される範囲外にある値には設定できません。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.WeekView Private Sub GetVisibleWeekInfo() Dim info As String = String.Empty ' 表示されている各有効な曜日に予定を追加します Dim dow As Infragistics.Win.UltraWinSchedule.DayOfWeek Dim i As Integer For i = 0 To 6 Dim temp As DateTime = Me.ultraWeekView.VisibleWeek.FirstDate.AddDays(i) ' この日に対応する曜日を取得します dow = Me.ultraWeekView.CalendarInfo.DaysOfWeek(Me.ultraWeekView.VisibleWeek.FirstDate.DayOfWeek) ' DayOfWeek が非表示の場合はスキップします If dow.Visible Then ' 日に予定を追加します Me.ultraWeekView.CalendarInfo.Appointments.Add(temp, "Appointment for " + temp.ToString("d")) End If Next ' 週の最初の日付および最後の日付を取得します info += "VisibleWeek information:" + vbCrLf info += "The first date in the VisibleWeek is " + Me.ultraWeekView.VisibleWeek.FirstDate.ToLongDateString() + vbCrLf info += "The last date in the VisibleWeek is " + Me.ultraWeekView.VisibleWeek.LastDate.ToLongDateString() + vbCrLf ' 週にアクティビティがあるかどうかを確認します ' アクティビティがある場合、各アクティビティ コレクションのカウントを表示します If (Me.ultraWeekView.VisibleWeek.HasActivity) Then info += "There is activity for the week of " + Me.ultraWeekView.VisibleWeek.FirstDate.ToShortDateString() + ":" + vbCrLf If Me.ultraWeekView.VisibleWeek.Appointments.Count > 0 Then info += vbCrLf + Me.ultraWeekView.VisibleWeek.Appointments.Count.ToString() + " Appointment(s)" + vbCrLf End If If (Me.ultraWeekView.VisibleWeek.Holidays.Count > 0) Then info += vbCrLf + Me.ultraWeekView.VisibleWeek.Holidays.Count.ToString() + " Holiday(s)" + vbCrLf End If If (Me.ultraWeekView.VisibleWeek.Notes.Count > 0) Then info += vbCrLf + Me.ultraWeekView.VisibleWeek.Notes.Count.ToString() + " Note(s)" + vbCrLf End If info += vbCrLf End If ' 週が有効かどうかを確認します If Me.ultraWeekView.VisibleWeek.Enabled Then info += "The week is enabled." + vbCrLf Else info += "The week is disabled." + vbCrLf End If ' その年の週番号を取得します info += "This week is week number " + Me.ultraWeekView.VisibleWeek.WeekNumber.ToString() + " in the year " + Me.ultraWeekView.VisibleWeek.Year.YearNumber.ToString() + "." + vbCrLf ' 情報を表示します MessageBox.Show(info, "GetVisibleWeekInfo") End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.WeekView; using System.Diagnostics; private void GetVisibleWeekInfo() { string info = string.Empty; // 表示されている各有効な曜日に予定を追加します Infragistics.Win.UltraWinSchedule.DayOfWeek dow = null; for ( int i = 0; i < 7; i ++ ) { DateTime temp = this.ultraWeekView.VisibleWeek.FirstDate.AddDays( (double)(i) ); // この日に対応する曜日を取得します dow = this.ultraWeekView.CalendarInfo.DaysOfWeek[ this.ultraWeekView.VisibleWeek.FirstDate.DayOfWeek ]; // DayOfWeek が非表示の場合はスキップします if ( ! dow.Visible ) continue; // 日にに予定を追加します this.ultraWeekView.CalendarInfo.Appointments.Add( temp, "Appointment for " + temp.ToString("d") ); } // 週の最初の日付および最後の日付を取得します info += "VisibleWeek information:\n\n"; info += "The first date in the VisibleWeek is " + this.ultraWeekView.VisibleWeek.FirstDate.ToLongDateString() + "\n"; info += "The last date in the VisibleWeek is " + this.ultraWeekView.VisibleWeek.LastDate.ToLongDateString() + "\n"; // 週にアクティビティがあるかどうかを確認します // アクティビティがある場合、各アクティビティ コレクションのカウントを表示します if ( this.ultraWeekView.VisibleWeek.HasActivity ) { info += "There is activity for the week of " + this.ultraWeekView.VisibleWeek.FirstDate.ToShortDateString() + ":" + "\n"; if ( this.ultraWeekView.VisibleWeek.Appointments.Count > 0 ) info += "\n" + this.ultraWeekView.VisibleWeek.Appointments.Count.ToString() + " Appointment(s)\n"; if ( this.ultraWeekView.VisibleWeek.Holidays.Count > 0 ) info += "\n" + this.ultraWeekView.VisibleWeek.Holidays.Count.ToString() + " Holiday(s)\n"; if ( this.ultraWeekView.VisibleWeek.Notes.Count > 0 ) info += "\n" + this.ultraWeekView.VisibleWeek.Notes.Count.ToString() + " Note(s)\n"; info += "\n"; } // 週が有効かどうかを確認します if ( this.ultraWeekView.VisibleWeek.Enabled ) info += "The week is enabled.\n"; else info += "The week is disabled.\n"; // その年の週番号を取得します info += "This week is week number " + this.ultraWeekView.VisibleWeek.WeekNumber.ToString() + " in the year " + this.ultraWeekView.VisibleWeek.Year.YearNumber.ToString() + ".\n"; // 情報を表示します MessageBox.Show( info, "GetVisibleWeekInfo" ); }