I have an issue with Winschedule Dayview. Here are the steps to reproduce:
1) Create an appointment
2) Create another appointment, back-to-back with the first one
3) Create a 3rd appointment which overlaps the time of the 2nd appointment
4) The 2nd appointment adjusts its width to 50%, to accomodate the display of the double-booked one
5) PROBLEM: the 1st appointment also adjust to 50% width, even though it really isn't double booked
(see attachment)
Our Infragistics library version is 7.1.20071.40
Your help is appreciated to provide a workaround (CreationFilter etc) or suggest a different Infragistics version in which this issue is fixed.
Here is the solution. I spent a day writing this improvement to how DayView handles double booking. I wish Infragistics would have taken the time to a) write this correctly to begin with, or at least b) test their code or even c) responded to my post.
public class DayViewCreationFilter : IUIElementCreationFilter { public void AfterCreateChildElements(UIElement parent) { if (parent is DayUIElement) { foreach (UIElement uie in parent.ChildElements) { AppointmentUIElement aui = uie as AppointmentUIElement; if (aui != null) { bool isDoubleBooked = false; foreach (UIElement uieInner in parent.ChildElements) { AppointmentUIElement auieInner = uieInner as AppointmentUIElement; if ((auieInner != null) && (auieInner != aui)) { if ((auieInner.Rect.Y == aui.Rect.Y) || // side by side ((auieInner.Rect.Y >= aui.Rect.Y) && (auieInner.Rect.Bottom <= aui.Rect.Bottom)) || // inside ((auieInner.Rect.Y <= aui.Rect.Y) && (auieInner.Rect.Bottom >= aui.Rect.Bottom)) || // outside ((auieInner.Rect.Y < aui.Rect.Y) && (auieInner.Rect.Bottom > aui.Rect.Y)) || // over top ((auieInner.Rect.Y < aui.Rect.Bottom) && (auieInner.Rect.Bottom >= aui.Rect.Bottom))) // over bottom { isDoubleBooked = true; break; } } } if (!isDoubleBooked) { // look for this appointment's shadow and adjust it too foreach (UIElement shuie in parent.ChildElements) { AppointmentShadowUIElement asui = shuie as AppointmentShadowUIElement; if ((asui != null) && (asui.Rect.X == aui.Rect.X + 5) && (asui.Rect.Y == aui.Rect.Y + 5)) asui.Rect = new Rectangle(asui.Rect.X, asui.Rect.Y, parent.Rect.Width - 10, asui.Rect.Height); } aui.Rect = new Rectangle(aui.Rect.X, aui.Rect.Y, parent.Rect.Width - 10, aui.Rect.Height); } } } } } public bool BeforeCreateChildElements(UIElement parent) { return false; } }