Hello,
I have found a way to change the timeslot color for a certain time period on the dayview using the code below however when I switch to the week view the red color doesn't show up. How would I change the timeslot color in the ultraweekview since there is no timeslot property link in ultradayview
For Each slot As TimeSlot In actDayView.TimeSlots
If slot.StartTime.Hour > 10 AndAlso slot.EndTime.Hour < 13 Then
slot.WorkingHourAppearance.BackColor =Color.Red
End If
Next
Hi Matthew,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
A possible approach to achieve your goal is to use the follwing code:
If TypeOf parent Is TimeSlotUIElement Then
Dim slotUI As TimeSlotUIElement = DirectCast(Parent, TimeSlotUIElement)
If DirectCast(slotUI.GetContext(), TimeSlot).StartTime.Hour > 10 AndAlso DirectCast(slotUI.GetContext(), TimeSlot).EndTime.Hour < 13 Then
Dim t As New TextUIElement(Parent, "Hello this is my custom text")
t.Rect = New System.Drawing.Rectangle(parent.Rect.X + 10, parent.Rect.Y, parent.Rect.Width, parent.Rect.Height)
parent.ChildElements.Add(t)
Please do not hesitate to contact us if you still have any other question related to this matter.
Perfect that is exactly what I want it to do, just wondering how do I put the label on a specific time slot and not on all of them like in your example. So that in the code below after I color the timeslot red it adds the label.
For Each slot As TimeSlot In DayView.TimeSlots
slot.WorkingHourAppearance.BackColor = Color.Red
(THIS IS WHERE I WOULD ADD THE LABEL TO THE TIMESLOT)
A possible approach to achieve your goal would be to use the "CreationFilter" like i did in the attached sample to this thread . I hope that this approach will satisfy your technical requirements.
Please do not hesitate to contact us if you still have any other questions with this matter.
Thanks for the above that was very useful. I had one more questions, is it possible to add text to a time slot? So for example on the DayView I could put some text write in the 8:30-9:00 timeslot, not an appointment by like a label on that timeslot?