'Declaration Public Property Appearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase Appearance {get; set;}
The Appearance property of an object is used to associate the object with an Appearance object that will determine its appearance. The Appearance object has properties that control settings such as color, borders, font, transparency, etc. For many of the objects in the UltraWinSchedule, you do not set formatting properties directly. Instead, you set the properties of an Appearance object, which controls the formatting of the object it is attached to.
There are two ways of working with the Appearance property and assigning the attributes of an SSAppearance object to other objects. One way is to create a new Appearance object, adding it directly to the Appearances collection. Then you assign the new Appearance object to the Appearance property of the object you want to format. This method uses a "named" Appearance object that you must explicitly create (and to which you must assign property settings) before it can be used. For instance, you could create an object in the control's Appearances collection and assign it some values as follows:
UltraDayView1.Appearances.Add "New1"
UltraDayViewSingle1.Appearances("New1").BorderColor = Color.Blue
UltraDayViewSingle1.Appearances("New1").ForeColor = Color.Red
Creating the object in this way does not apply formatting to any visible part of the control. The object simply exists in the collection with its property values, waiting to be used. To actually use the object, you must assign it to the control's (or another object's) Appearance property:
UltraDayViewSingle1.Appearance = UltraDayViewSingle1.Appearances("New1")
In this case, only one Appearance object exists. The control's appearance is governed by the settings of the "New1" object in the collection. Any changes you make to the object in the collection will immediately be reflected in the control.
The second way of working with the Appearance property is to use it to set property values directly, such as:
UltraDayViewSingle1.Appearance.ForeColor = Color.Blue
In this case, an Appearance object is automatically created by the control. This Appearance object is not a member of an Appearances collection and it does not have a name. It is specific to the object for which it was created; it is an "intrinsic" Appearance object. Changes to the properties of an intrinsic Appearance object are reflected only in the object to which it is attached.
Note that you can assign properties from a named Appearance object to an intrinsic Appearance object without creating a dependency relationship. For example, the following code...
UltraDayViewSingle1.Appearance.ForeColor = UltraDayViewSingle1.Appearances("New1").ForeColor
...does not establish a relationship between the foreground color of the intrinsic object and that of the named object. It is simply a one-time assignment of the named object's value to that of the intrinsic object. In this case, two Appearance objects exist - one in the collection and one attached to the control - and they operate independently of one another.
If you wish to assign all the properties of a named object to an intrinsic object at once without creating a dependency relationship, you can use the Clone method of the Appearance object to duplicate its settings and apply them. So if you wanted to apply all the property settings of the named Appearance object "New1" to the control's intrinsic Appearance object, but you did not want changes made to "New1" automatically reflected in the control, you would use the following code:
UltraDayViewSingle1.Appearance = UltraDayViewSingle1.Appearances("New1").Clone
Note that the properties of an Appearance object can also operate in a hierarchical fashion. Certain properties can be set to a "use default" value, which indicates to the control that the property should take its setting from the object's parent. This functionality is enabled by default, so that unless you specify otherwise, child objects resemble their parents, and formatting set at higher levels of the control hierarchy is inherited by objects lower in the hierarchy.
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Initialize UltraDayView control level properties. ' Add a gradient backcolor to the AllDayEventArea Me.UltraDayView1.AllDayEventAreaAppearance.BackColor = Color.CadetBlue Me.UltraDayView1.AllDayEventAreaAppearance.BackColor2 = Color.Blue Me.UltraDayView1.AllDayEventAreaAppearance.BackGradientStyle = GradientStyle.Horizontal ' Change the control's forecolor to dark blue. Me.UltraDayView1.AllDayEventAreaAppearance.ForeColor = Color.Blue ' Set AutoAppointmentDialog to true. This will cause the Appointment dialog ' to be automaticall displayed when the user double-clicks on an appointment ' or time slot. Me.UltraDayView1.AutoAppointmentDialog = True ' Change the border style to raised. Me.UltraDayView1.BorderStyle = UIElementBorderStyle.Raised ' Check the control's current state - if there is an appointment currently in edit ' write a message to the output window. If ((Me.UltraDayView1.CurrentState And UltraDayViewState.AppointmentInEdit) <> 0) Then Debug.WriteLine("Appointment in edit") End If ' Set come edit appearance colors. Me.UltraDayView1.EditAppearance.BackColor = Color.Black Me.UltraDayView1.EditAppearance.ForeColor = Color.Green ' If the first visible time slot's starting time is equal to 12, display a message ' in the output window. If (Me.UltraDayView1.FirstVisibleTimeSlot.StartTime.Hour = 12) Then Debug.WriteLine("The noontime time slot is positioned at the top of the day view.") End If ' Hide the time slot descriptor area. Me.UltraDayView1.HideTimeSlotDescriptorArea = True ' Set the time bar color for time slots with no activity to Gray. Me.UltraDayView1.IdleTimeBarColor = Color.Gray ' Change the backcolor for the time slots. Me.UltraDayView1.NonWorkingHourTimeSlotAppearance.BackColor = Color.CadetBlue Me.UltraDayView1.WorkingHourTimeSlotAppearance.BackColor = Color.LightBlue ' Make sure the dayview's scrollbar is visible. Me.UltraDayView1.ScrollbarVisible = True ' Change the backcolor for selected time slots if the currently selected time ' starts before noon. If (Me.UltraDayView1.SelectedTimeSlotRange.StartDateTime.Hour < 12) Then Me.UltraDayView1.SelectedTimeSlotAppearance.BackColor = Color.CadetBlue End If ' Change the backcolor of the selected visible day. Me.UltraDayView1.SelectedVisibleDayAppearance.BackColor = Color.Red ' Look at each selected visible day and display a message in the output window for ' each day that is in the first week of the year. Dim selectedVisibleDay As VisibleDay For Each selectedVisibleDay In Me.UltraDayView1.SelectedVisibleDays If (selectedVisibleDay.Day.Week.WeekNumber = 1) Then Debug.WriteLine("Selected visible day found in week 1. (Date: " + selectedVisibleDay.Date.ToString() + ")") End If Next ' Add a gradient the TimeSlotDescriptors. Me.UltraDayView1.TimeSlotDescriptorAppearance.BackColor2 = SystemColors.ControlDark Me.UltraDayView1.TimeSlotDescriptorAppearance.BackGradientStyle = GradientStyle.Horizontal ' Set the time slot interval to every 15 minutes. Me.UltraDayView1.TimeSlotInterval = TimeSlotInterval.FifteenMinutes ' Set the backcolor to green for each time slot that starts on the half hour. Dim timeSlot As TimeSlot For Each timeSlot In Me.UltraDayView1.TimeSlots If timeSlot.StartTime.Minute = 30 Then timeSlot.NonWorkingHourAppearance.BackColor = Color.Green timeSlot.WorkingHourAppearance.BackColor = Color.Green End If Next ' Display the DayView control's current dimensions in the output window. Debug.WriteLine("The DayView's dimensions are: " + Me.UltraDayView1.UIElement.Rect.Width.ToString() + " x " + Me.UltraDayView1.UIElement.Rect.Height.ToString()) ' Look at each visible day and display a message in the output window for ' each visible day that falls on monday. Dim visibleDay As VisibleDay For Each visibleDay In Me.UltraDayView1.SelectedVisibleDays If visibleDay.Date.DayOfWeek = System.DayOfWeek.Monday Then Debug.WriteLine("Visible day found that falls on a monday. (Date: " + visibleDay.Date.ToString() + ")") End If Next End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void Form1_Load(object sender, System.EventArgs e) { // Initialize UltraDayView control level properties. // Add a gradient backcolor to the AllDayEventArea this.ultraDayView1.AllDayEventAreaAppearance.BackColor = Color.CadetBlue; this.ultraDayView1.AllDayEventAreaAppearance.BackColor2 = Color.Blue; this.ultraDayView1.AllDayEventAreaAppearance.BackGradientStyle = GradientStyle.Horizontal; // Change the control's forecolor to dark blue. this.ultraDayView1.AllDayEventAreaAppearance.ForeColor = Color.Blue; // Set AutoAppointmentDialog to true. This will cause the Appointment dialog // to be automaticall displayed when the user double-clicks on an appointment // or time slot. this.ultraDayView1.AutoAppointmentDialog = true; // Change the border style to raised. this.ultraDayView1.BorderStyle = UIElementBorderStyle.Raised; // Check the control's current state - if there is an appointment currently in edit // write a message to the output window. if ( (this.ultraDayView1.CurrentState & UltraDayViewState.AppointmentInEdit) == UltraDayViewState.AppointmentInEdit) Debug.WriteLine("Appointment in edit"); // Set come edit appearance colors. this.ultraDayView1.EditAppearance.BackColor = Color.Black; this.ultraDayView1.EditAppearance.ForeColor = Color.Green; // If the first visible time slot's starting time is equal to 12, display a message // in the output window. if (this.ultraDayView1.FirstVisibleTimeSlot.StartTime.Hour == 12) Debug.WriteLine("The noontime time slot is positioned at the top of the day view."); // Hide the time slot descriptor area. this.ultraDayView1.HideTimeSlotDescriptorArea = true; // Set the time bar color for time slots with no activity to Gray. this.ultraDayView1.IdleTimeBarColor = Color.Gray; // Change the backcolor for the time slots. this.ultraDayView1.NonWorkingHourTimeSlotAppearance.BackColor = Color.CadetBlue; this.ultraDayView1.WorkingHourTimeSlotAppearance.BackColor = Color.LightBlue; // Make sure the dayview's scrollbar is visible. this.ultraDayView1.ScrollbarVisible = true; // Change the backcolor for selected time slots if the currently selected time // starts before noon. if (this.ultraDayView1.SelectedTimeSlotRange.StartDateTime.Hour < 12) this.ultraDayView1.SelectedTimeSlotAppearance.BackColor = Color.CadetBlue; // Change the backcolor of the selected visible day. this.ultraDayView1.SelectedVisibleDayAppearance.BackColor = Color.Red; // Look at each selected visible day and display a message in the output window for // each day that is in the first week of the year. foreach(VisibleDay selectedVisibleDay in this.ultraDayView1.SelectedVisibleDays) { if (selectedVisibleDay.Day.Week.WeekNumber == 1) Debug.WriteLine("Selected visible day found in week 1. (Date: " + selectedVisibleDay.Date.ToString() + ")"); } // Add a gradient the TimeSlotDescriptors. this.ultraDayView1.TimeSlotDescriptorAppearance.BackColor2 = SystemColors.ControlDark; this.ultraDayView1.TimeSlotDescriptorAppearance.BackGradientStyle = GradientStyle.Horizontal; // Set the time slot interval to every 15 minutes. this.ultraDayView1.TimeSlotInterval = TimeSlotInterval.FifteenMinutes; // Set the backcolor to green for each time slot that starts on the half hour. foreach(TimeSlot timeSlot in this.ultraDayView1.TimeSlots) { if (timeSlot.StartTime.Minute == 30) { timeSlot.NonWorkingHourAppearance.BackColor = Color.Green; timeSlot.WorkingHourAppearance.BackColor = Color.Green; } } // Display the DayView control's current dimensions in the output window. Debug.WriteLine("The DayView's dimensions are: " + this.ultraDayView1.UIElement.Rect.Width.ToString() + " x " + this.ultraDayView1.UIElement.Rect.Height.ToString()); // Look at each visible day and display a message in the output window for // each visible day that falls on monday. foreach(VisibleDay visibleDay in this.ultraDayView1.SelectedVisibleDays) { if (visibleDay.Date.DayOfWeek == System.DayOfWeek.Monday) Debug.WriteLine("Visible day found that falls on a monday. (Date: " + visibleDay.Date.ToString() + ")"); } }
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