'Declaration Public Shadows ReadOnly Property UIElement As UltraWeekViewUIElement
public new UltraWeekViewUIElement UIElement {get;}
The UIElement property provides access to the visual representation of the UltraWeekView control.
The control's UIElement property exposes a ChildElements collection under which all of the control's many individual UIElements appear as descendants.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.WeekView Private Sub OptimizeControlForAppointmentDisplay() Dim yesterday As DateTime = DateTime.Today.AddDays(-1) Dim today As DateTime = DateTime.Today Dim tomorrow As DateTime = DateTime.Today.AddDays(1) Dim i As Integer ' If there are no activities, let's add a few ' Add appointments If Me.ultraWeekView.CalendarInfo.Appointments.Count = 0 Then For i = 1 To 5 Me.ultraWeekView.CalendarInfo.Appointments.Add(yesterday, "Yesterday's appointment " + i.ToString()) Next For i = 1 To 3 Me.ultraWeekView.CalendarInfo.Appointments.Add(today, "Today's appointment " + i.ToString()) Next For i = 1 To 10 Me.ultraWeekView.CalendarInfo.Appointments.Add(tomorrow, "Tomorrow's appointment " + i.ToString()) Next End If ' Add notes If Me.ultraWeekView.CalendarInfo.Notes.Count = 0 Then Me.ultraWeekView.CalendarInfo.Notes.Add(yesterday, "Yesterday's note " + i.ToString()) For i = 1 To 2 Me.ultraWeekView.CalendarInfo.Notes.Add(today, "Today's note " + i.ToString()) Next For i = 1 To 5 Me.ultraWeekView.CalendarInfo.Notes.Add(tomorrow, "Tomorrow's note " + i.ToString()) Next End If ' Add a holiday If Me.ultraWeekView.CalendarInfo.Holidays.Count = 0 Then Me.ultraWeekView.CalendarInfo.Holidays.Add(yesterday, "My 2-day Holiday") End If ' First let's determine which day has the most activity ' We do this by counting the occurrences of a given date ' in all the appointments' StartDateTime property, keeping ' track of the one with the most occurrences ' Dim dateWithMostActivity As DateTime = DateTime.Today Dim count As Integer = 0 Dim tempCount As Integer = 0 Dim outer As Appointment Dim inner As Appointment For Each outer In Me.ultraWeekView.CalendarInfo.Appointments tempCount = 0 For Each inner In Me.ultraWeekView.CalendarInfo.Appointments If inner.StartDateTime.Date = outer.StartDateTime Then tempCount += 1 Next ' If this date has more appointments that all others before ' it, adjust the count and set the new dateWithMostActivity If tempCount > count Then count = tempCount dateWithMostActivity = outer.StartDateTime End If Next ' If there are no appointments, return without doing anything If count = 0 Then Return ' Set the CalendarInfo object's FirstDayOfWeek property to the same day of the week ' as the day that has the most appointments Me.ultraWeekView.CalendarInfo.FirstDayOfWeek = dateWithMostActivity.DayOfWeek ' Set the Visible property of all DayOfWeek objects to false, ' except for the one that we want to see Dim dow As Infragistics.Win.UltraWinSchedule.DayOfWeek For Each dow In Me.ultraWeekView.CalendarInfo.DaysOfWeek If dow.DayOfTheWeek <> dateWithMostActivity.DayOfWeek Then dow.Visible = False Else dow.Visible = True Next ' Set the CalendarInfo object's ActiveDay property to the same day as the ' date with the most activity Me.ultraWeekView.CalendarInfo.ActiveDay = Me.ultraWeekView.CalendarInfo.GetDay(dateWithMostActivity, True) ' Scroll the day into view to ensure that it is visible Me.ultraWeekView.ScrollDayIntoView(dateWithMostActivity) ' Since our task here is to optimize the control's display for Appointments, ' let's use the control's ActivityDisplayStyle property to suppress the displaying ' of other activities (Notes and Holidays). Me.ultraWeekView.ActivityDisplayStyle = ActivityDisplayStyleEnum.Appointments ' Dirty and verify all UIElements to update the display Me.ultraWeekView.UIElement.DirtyChildElements() Me.ultraWeekView.UIElement.VerifyChildElements() ' Set the DayDisplayStyle property to Full Me.ultraWeekView.DayDisplayStyle = DayDisplayStyleEnum.Full End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.WeekView; using System.Diagnostics; private void OptimizeControlForAppointmentDisplay() { DateTime yesterday = DateTime.Today.AddDays( -1.0F ); DateTime today = DateTime.Today; DateTime tomorrow = DateTime.Today.AddDays( 1.0F ); // If there are no activities, let's add a few // Add appointments if ( this.ultraWeekView.CalendarInfo.Appointments.Count == 0 ) { for ( int i = 1; i <= 5; i ++ ) this.ultraWeekView.CalendarInfo.Appointments.Add(yesterday, "Yesterday's appointment " + i.ToString() ); for ( int i = 1; i <= 3; i ++ ) this.ultraWeekView.CalendarInfo.Appointments.Add(today, "Today's appointment " + i.ToString() ); for ( int i = 1; i <= 10; i ++ ) this.ultraWeekView.CalendarInfo.Appointments.Add(tomorrow, "Tomorrow's appointment " + i.ToString() ); } // Add notes if ( this.ultraWeekView.CalendarInfo.Notes.Count == 0 ) { for ( int i = 1; i <= 1; i ++ ) this.ultraWeekView.CalendarInfo.Notes.Add(yesterday, "Yesterday's note " + i.ToString() ); for ( int i = 1; i <= 2; i ++ ) this.ultraWeekView.CalendarInfo.Notes.Add(today, "Today's note " + i.ToString() ); for ( int i = 1; i <= 5; i ++ ) this.ultraWeekView.CalendarInfo.Notes.Add(tomorrow, "Tomorrow's note " + i.ToString() ); } // Add a holiday if ( this.ultraWeekView.CalendarInfo.Holidays.Count == 0 ) this.ultraWeekView.CalendarInfo.Holidays.Add(yesterday, "My 2-day Holiday" ); // First let's determine which day has the most activity // We do this by counting the occurrences of a given date // in all the appointments' StartDateTime property, keeping // track of the one with the most occurrences // DateTime dateWithMostActivity = DateTime.Today; int count = 0, tempCount = 0; foreach( Appointment outer in this.ultraWeekView.CalendarInfo.Appointments ) { tempCount = 0; foreach( Appointment inner in this.ultraWeekView.CalendarInfo.Appointments ) { if ( inner.StartDateTime.Date == outer.StartDateTime.Date ) tempCount++; } // If this date has more appointments that all others before // it, adjust the count and set the new dateWithMostActivity if ( tempCount > count ) { count = tempCount; dateWithMostActivity = outer.StartDateTime; } } // If there are no appointments, return without doing anything if ( count == 0 ) return; // Set the CalendarInfo object's FirstDayOfWeek property to the same day of the week // as the day that has the most appointments this.ultraWeekView.CalendarInfo.FirstDayOfWeek = (FirstDayOfWeek)( dateWithMostActivity.DayOfWeek ); // Set the Visible property of all DayOfWeek objects to false, // except for the one that we want to see foreach( Infragistics.Win.UltraWinSchedule.DayOfWeek dow in this.ultraWeekView.CalendarInfo.DaysOfWeek ) { if ( (int)(dow.DayOfTheWeek) != (int)(dateWithMostActivity.DayOfWeek) ) dow.Visible = false; else dow.Visible = true; } // Set the CalendarInfo object's ActiveDay property to the same day as the // date with the most activity this.ultraWeekView.CalendarInfo.ActiveDay = this.ultraWeekView.CalendarInfo.GetDay( dateWithMostActivity, true ); // Scroll the day into view to ensure that it is visible this.ultraWeekView.ScrollDayIntoView( dateWithMostActivity ); // Since our task here is to optimize the control's display for Appointments, // let's use the control's ActivityDisplayStyle property to suppress the displaying // of other activities (Notes and Holidays). this.ultraWeekView.ActivityDisplayStyle = ActivityDisplayStyleEnum.Appointments; // Dirty and verify all UIElements to update the display this.ultraWeekView.UIElement.DirtyChildElements(); this.ultraWeekView.UIElement.VerifyChildElements(); // Set the DayDisplayStyle property to Full this.ultraWeekView.DayDisplayStyle = DayDisplayStyleEnum.Full; }
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