Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.GetDayUIElementInfo(DateTime.Today) End Sub Private Sub GetDayUIElementInfo(ByVal theDate As DateTime) Dim info As String = String.Empty ' Create a Day object from the specified date, which we will use as the ' 'context' parameter to the UIElement's GetDescendant method Dim day As Infragistics.Win.UltraWinSchedule.Day = Me.ultraWeekView.CalendarInfo.GetDay(theDate, True) ' Use the UIElement object's GetDescendant method to find the DayUIElement ' that corresponds to the specified date. Note that the method will return null ' if no such element is found, which means that the day is not currently visible. Dim dayUIElement As DayUIElement = Me.ultraWeekView.UIElement.GetDescendant(GetType(DayUIElement), day) ' If we did not locate a DayUIElement for the specified date, then ' the day is not currently visible. If (dayUIElement Is Nothing) Then info += theDate.ToLongDateString() + " is not currently visible." Else ' The Date property returns the date that this DayUIElement represents info += dayUIElement.Date.ToLongDateString() + " is currently visible." + vbCrLf ' The Day property returns the Day object that corresponds to the date ' that this DayUIElement represents. From the Day object, we can get additional ' information about that day, for example, whether it is selected. If (dayUIElement.Day.Selected) Then info += dayUIElement.Date.ToLongDateString() + " is currently selected." + vbCrLf End If End If ' Output the information to the debugger Debug.WriteLine(info) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void button1_Click(object sender, System.EventArgs e) { this.GetDayUIElementInfo( DateTime.Today ); } private void GetDayUIElementInfo( DateTime date ) { string info = string.Empty; // Create a Day object from the specified date, which we will use as the // 'context' parameter to the UIElement's GetDescendant method Infragistics.Win.UltraWinSchedule.Day day = this.ultraWeekView1.CalendarInfo.GetDay( date, true ); // Use the UIElement object's GetDescendant method to find the DayUIElement // that corresponds to the specified date. Note that the method will return null // if no such element is found, which means that the day is not currently visible. DayUIElement dayUIElement = this.ultraWeekView1.UIElement.GetDescendant( typeof(DayUIElement), day ) as DayUIElement; // If we did not locate a DayUIElement for the specified date, then // the day is not currently visible. if ( dayUIElement == null ) info += date.ToLongDateString() + " is not currently visible."; else { // The Date property returns the date that this DayUIElement represents info += dayUIElement.Date.ToLongDateString() + " is currently visible." + "\n"; // The Day property returns the Day object that corresponds to the date // that this DayUIElement represents. From the Day object, we can get additional // information about that day, for example, whether it is selected. if ( dayUIElement.Day.Selected ) info += dayUIElement.Date.ToLongDateString() + " is currently selected." + "\n"; } // Output the information to the debugger Debug.WriteLine( info ); }