HI
I have implemented the solution by Georgi to show multiple tasks on one line (http://es.infragistics.com/community/forums/t/63942.aspx)
I have found though that when a sub group is shrunk (not expanded) and the time line is scrolled form left to right the original tasks do not get re-painted and stay in position.
My method
public void AfterCreateChildElements(UIElement parent) { int LastLevel = 0; Boolean LevelVis = false; MyTask Level1Tasks = null; try { TaskAreaUIElement El1 = parent as TaskAreaUIElement; TimeSlotUIElement El2 = parent as TimeSlotUIElement; TaskUIElement El = parent as TaskUIElement; if (El1 != null) tAreaEl = El1; if (El2 != null) tSlot = El2; int xLoc = 0; if (El1 != null) tAreaEl = El1; if (El2 != null) tSlot = El2; foreach (UIElement ui in parent.ChildElements.Where(x => x.GetType() == typeof(TaskUIElement))) { TaskUIElement Eln = ui as TaskUIElement; if (!xCords.ContainsKey(Eln.Task.StartDateTime.Date)) { xCords.Add(Eln.Task.StartDateTime.Date, ui.Rect.X); } else { xCords.Remove(Eln.Task.StartDateTime.Date); xCords.Add(Eln.Task.StartDateTime.Date, ui.Rect.X); } } if (El != null && El.GetType() == typeof(TaskUIElement)) { MyTask mt = El.Task as MyTask; if (mt != null && mt.MySubTask.Count > 0) { bool expanded = mt.Expanded; foreach (Infragistics.Win.UltraWinSchedule.Task item in mt.MySubTask) { if (expanded) { int Coord = xCords.FirstOrDefault(x => x.Key == item.StartDateTime.Date).Value; var IntervalType = item.Name; int newmultiplier = 1; TimeSpan ts = item.StartDateTime.Date - mt.StartDateTime.Date; TaskUIElement tb = new TaskUIElement(tAreaEl, item); tb.Rect = new Rectangle((Coord), ((TaskUIElement)El).Rect.Y, tSlot.Rect.Width * (int)(item.Duration.TotalHours) / 2, 19); elementToAdd.Rect = new Rectangle((Coord), ((TaskUIElement)El).Rect.Y, tSlot.Rect.Width * (int)(item.Duration.TotalHours) / 2, 19); tAreaEl.ChildElements.Add(tb) xLoc += 1; } else { TimeSpan Endts = mt.EndDateTime.Date - mt.StartDateTime.Date; TaskUIElement tb = new TaskUIElement(tAreaEl, item); tb.Rect = new Rectangle(xCords.FirstOrDefault().Value, ((TaskUIElement)El).Rect.Y, (int)(Endts.TotalDays) / 2, 19); tAreaEl.ChildElements.Add(tb); } } } } } catch (Exception ex) { throw; } }
Hello Simon,
Thank you for your update. Can you please clarify your question and requirement please? Would you mind attaching a mock up sample and/or image as well?
Hi Michael,
Thanks for coming back to me.
I have slightly moved on from this now but do have a query along a similar line.
I am now looking to draw a task with another task overlay. This is going to be used to show the boundaries in which the overlayed task can be moved.
I have it working mostly still using the idea from the example that Georgie provided but i have real difficulty in trying to map the point of a task to the equivalent X coord on the timeline.
How does a date relate to the X coord on the timeline?
many thanks
Thank you for providing code but would it be possible to provide a sample that demonstrates the behavior with steps to reproduce?