Hello,
I am trying to access the editor used to display appointments on the timelineview for each appointment. The reason I am trying this is because i want to set the barheight for each appointment differently. I know it is possible, I just want to know which direction I should go (overwriting the creationFilters method or any other way).
Thank you!
Dear man.
How to get the owner id and the date corresponse to the TextUIElemnet of the TimeLineView after use creation filter (replace TimeSlotUIElement with TextUIElement).
Hi,
Well, all you have to do is place the TextUIElement in one of the ActivityAreaUIElement's child elements.
The TextUIElement itself does not contain info about the owner id or date, but going up his Parent elements you will reach one that does (for example the AppointmentUIElement).
Once you have the appointment element, you can easily convert it to an appointment and then get owner and date:
Infragistics.Win.UltraWinSchedule.Appointment appointment = element.GetContext(typeof(Infragistics.Win.UltraWinSchedule.Appointment)) as Infragistics.Win.UltraWinSchedule.Appointment;
// where element is the AppointmentUIElement you will reach while looping on the TextUIElement's parents
I hope that clears it up for you, remember you do not have to pass on the owner or the datetime to the TextUIElement, you can get that from it's Parent elements.
Cheers!
Yes, you are right, it is not. My mistake.
The appointment is in the ActivityAreaUI element. To make it "fill" a TimeSlotUI, or more:
1. you have to get the startdate end enddate of the actual Appointment and set them to you own pleasing - this solves the width problem, the AppointmentUIElement will strech according to the dates of the appointment.
2. to solve the height problem:
if (elem is Infragistics.Win.UltraWinSchedule.TimelineView.AppointmentUIElement)
{
Infragistics.Win.UltraWinSchedule.TimelineView.ActivityAreaUIElement parent = elem.GetAncestor(typeof(Infragistics.Win.UltraWinSchedule.TimelineView. ActivityAreaUIElement));
elem.Rect = new Rectangle(elem.Rect.X, elem.Rect.Y, elem.Rect.Width, parent.Rect.Height);
}
Now you will have your appointmentUI as high as the owner (ActivityArea), which is as high as a timeslotUI. How wide it should strech it is up to you by setting the dates of the appointment.
If you need to get the Appointment Element from the AppointmentUIElement, here is the code:
Infragistics.Win.UltraWinSchedule.Appointment appointment = elem.GetContext(typeof(Infragistics.Win.UltraWinSchedule.Appointment)) as Infragistics.Win.UltraWinSchedule.Appointment;
Please test it, see if it works and get back to me.
Following your guide, I use this code public void AfterCreateChildElements(Infragistics.Win.UIElement parent) // Implements Infragistics.Win.IUIElementCreationFilter.AfterCreateChildElements { if (parent is Infragistics.Win.UltraWinSchedule.TimelineView.AppointmentUIElement) // it is the descendant of ColumnHeader { ActivityAreaUIElement act = parent.GetAncestor(typeof(ActivityAreaUIElement)) as ActivityAreaUIElement; TimeSlotUIElement tsl = act.GetDescendant(typeof(TimeSlotUIElement)) as TimeSlotUIElement; parent.Rect = tsl.Rect;// new Rectangle(tsl.Rect.X, tsl.Rect.Y, parent.Rect.Width, parent.Rect.Height); } }When app run, the appointment fill the timeslotui area, but when scroll to another day in the timelineview, the appointment remain the same locaion.my timelineview control have only one appointment per day, and that appointment does not span across multiple daysPlease help.
Yes, you are right. This is what it should do, because the TimeSchedule control is designed this way. if you want to keep the appointment in that spot, then this is not the way to go.
If you need the functionality of an appointment, then you must change the dates of the appointment each time you scroll you control, so use that event. The timeslot changes position each time you scroll the dates, it is designed to do that. You need to move the appointment when you scroll through them, so it seems that it maintains it's position. I however you not do that. I would just add some graphic object (any rectangle) and set it's position relative to the control, so it never changes. I would add the UI in the ActivityAreaUI I think, though I am not sure.
I cannot give you the exact code to this as I did not use this before. You must calculate the position of your rectangle and always be aware of all resizing events.
Hope it clears things up, at least a bit...
Dear Gigi Dolar!
Thank you for your helping during last time.
Finally, I found solution for this work:
all the code is:
public void AfterCreateChildElements(Infragistics.Win.UIElement parent) { if (parent is Infragistics.Win.UltraWinSchedule.TimelineView.AppointmentUIElement) { ActivityAreaUIElement tlvControls = parent.GetAncestor(typeof(ActivityAreaUIElement)) as ActivityAreaUIElement; foreach (UIElement elem in tlvControls.ChildElements) { if (elem is TimeSlotUIElement) { Appointment app = parent.GetContext(typeof(Appointment)) as Appointment; if (((TimeSlotUIElement)elem).DateTimeRange.StartDateTime.ToString("dd/MM/yyyy") == app.StartDateTime.ToString("dd/MM/yyyy")) parent.Rect=elem.Rect; } if (elem is ActivityGrabHandleUIElement) { tlvControls.ChildElements.Remove(elem); } } } }
Thank again.
Hi!
I'm glad it helped you. Keep up the good work, if there is anything else you need to ask post it here and I will reply!
Have a nice day