In the DayView component, when a user clicks on a timeslot under any given owner, that timeslot gets highlighted. I'm trying to accomplish the same thing in code. Basically, instead of the user left-clicking on a timeslot, I want to highlight one for them. So far, I've been able to get the TimeSlotUIElement object for the timeslot that I want to highlight using the following code.
UW.TimeSlot ts = vDays.GetTimeSlotFromTime(dtTimeToHighlight);object[] contexts = new object[2] { myOwner, ts };InfWin.DayView.TimeSlotUIElement tsUI = vDays.UIElement.GetDescendant(typeof(UW.DayView.TimeSlotUIElement), contexts) as InfWin.DayView.TimeSlotUIElement;
This code appears to return the correct UI element, however I can't figure out what I need to do with it to produce the same effect as the user clicking on it. I had assumed there was a Selected property or perhaps an OnClick event that I could fire manually to highlight this timeslot, but I can't seem to find anything like that.
Thanks,
- Bret
The property you are looking for is called SelectedTimeSlotRange. It is an object that exposes a SetRange method, which you can use to programmatically select one or more TimeSlots. Note that only contiguous selection is supported.
That helps with part of my problem, but still isn't quite getting me what I need. If I use the funtion mentioned above, it will highlight the timeslot in the column of whichever owner the user last clicked, and if the user has not clicked on an owner's column yet nothing gets highlighted at all.
So, I just need to figure out how to select an Owner programmatically and so that I can determine in which column the timeslot is highlighted. I didn't see anything obvious on the Owner or UltraDayView objects.
thanks,
Assign a reference to the Owner in question to the control's ActiveOwner property.
That did it.