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.ultraMonthViewSingle1.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.ultraMonthViewSingle1.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 VisiblePosition property tells us where the day appears in the week ' to which it belongs. A VisiblePosition of zero, for example, is the leftmost ' day in that week. info += dayUIElement.Date.ToLongDateString() + " is currently visible." + vbCrLf info += "Its VisiblePosition is " + dayUIElement.VisiblePosition.ToString() + vbCrLf ' The MoreActivityIndicatorVisible property tells us whether there is ' hidden activity for this DayUIElement If (dayUIElement.MoreActivityIndicatorVisible) Then info += "There is more activity for " + dayUIElement.Date.ToLongDateString() + " than can be displayed at the current size." + vbCrLf End If ' 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.ultraMonthViewSingle1.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.ultraMonthViewSingle1.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 VisiblePosition property tells us where the day appears in the week // to which it belongs. A VisiblePosition of zero, for example, is the leftmost // day in that week. info += dayUIElement.Date.ToLongDateString() + " is currently visible." + "\n"; info += "Its VisiblePosition is " + dayUIElement.VisiblePosition.ToString() + "\n"; // The MoreActivityIndicatorVisible property tells us whether there is // hidden activity for this DayUIElement if ( dayUIElement.MoreActivityIndicatorVisible ) info += "There is more activity for " + dayUIElement.Date.ToLongDateString() + " than can be displayed at the current size." + "\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 ); }