I am trying to replace the standard summary row so that all TaskUIElements of subtasks are drawn in the summary task row. I tried the DrawFilter and had some luck with that: As soon as the summary is drawn (DrawElement-Method) I get the UIElements of the subtasks, offset them to the Y-position of the summary and call DrawElement of the subtask UIElement. Then I offset the subtasks back to their normal position and let them draw the regular way.
Code looks like this:
public bool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams){ Task t = (Task)drawParams.Element.GetContext(typeof(Task), true);
if (t != null && t.IsSummary) { foreach (Task tsub in t.Tasks) { UIElement tsubUI = this.ultraGanttView1.UIElement.GetDescendant(typeof(TaskUIElement), tsub);
if (tsubUI == null) continue;
int deltaY = drawParams.Element.Rect.Y - tsubUI.Rect.Y;
tsubUI.Offset(0, deltaY); tsubUI.DrawElement(ref drawParams); tsubUI.Offset(0, -deltaY); }
return true; }}
The only problem is, that as soon as I close up the summary in the grid part of the UltraGanttView, no UIElements are created for the Subtasks. I understand that behavior, but is it possible to create TaskUIElements manually for the subtasks like the GanttView would do and paint them in the summary row? I have tried this but can't figure out the correct TaskUIElement.Rect dimensions. As soon as I create the TaskUIElement for the subtask the Rect is 0,0,0,0. Is there a way to calculate the dimensions of the rectangle?
Thanks again for your feedback. For us is very important to know your oppinion. Please do not hesitate to write us if you have any questions.
Regards
Hello Georgi,
thanks for the reply. That was the thing we needed, but as I said, the answer comes about one year too late. We are using NetAdvantage since 2006 and are (mostly) highly satisfied with the components - especially with UltraWinGrid. We have a 100+ grids in our enterprise application and we never saw something UltraWinGrid can't handle.
We took a look at TimeLineView (that was a little buggy in the initial release in 2009 ;) ) and UltraDayView but it wasn't "the schedule look" we wanted for our application. UltraGanttView had the look we wanted but the described subtask issue couldn't been solved back then - so we decided to buy a component from a competitor for that part.
You really should implement some functions/properties in UltraGanttView to ease up things for this scenario ;-) The scenario is not as seldom as you might think (like in personnel planning) and a GanttView is a great way to present a compressed summary (who works when).
Hello Stefan,
Thanks for the feedback. Could you please take a look at that form thread http://forums.infragistics.com/forums/t/63942.aspx Maybe you are looking for something similar ( see attached screenshot and sample)
Also did you have a time to take a look at the other controls. For example UltraTimeLineView:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinTimelineView_About_WinTimelineView.html
or UltraDayView:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinDayView_Setting_Different_Working_Hours_for_Different_Owners.html
Please let me know if you have any questions
Thanks and Regards
sorry, the answer comes about one year too late. We switched to another component as we needed this: We needed to draw all subtasks of a task within one summary row. This is needed if you are doing a resource based schedule. Let's say you have people as tasks and their working times as subtasks you need to draw every subtask in the summary row of the task. In other words: You have to draw multiple timelines for one task. WinGanttView can't do this ;-)
Hello Stafan,
I`m not sure that I understand your scenario, but maybe you could use a CreationFilter and set the Rectangle of your TaskUIElement. For example:
public void AfterCreateChildElements(UIElement parent) { 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; if (El != null && El.GetType() == typeof(TaskUIElement)) { MyTask mt = El.Task as MyTask; if (mt != null && mt.MySubTask.Count > 0) { foreach (Task item in mt.MySubTask) { TimeSpan ts = item.StartDateTime - mt.StartDateTime; TaskUIElement tb = new TaskUIElement(tAreaEl, item); tb.Rect = new Rectangle(((TaskUIElement)El).Rect.X + (mt.Duration.Days * tSlot.Rect.Width * ts.Days), ((TaskUIElement)El).Rect.Y, tSlot.Rect.Width * item.Duration.Days, 19); tAreaEl.ChildElements.Add(tb); TaskDependencyLineUIElement line = new TaskDependencyLineUIElement(tAreaEl, item, mt, TaskDependencyType.FinishToStart, Orientation.Horizontal); line.Rect = new Rectangle(((TaskUIElement)El).Rect.X + (mt.Duration.Days * tSlot.Rect.Width), ((TaskUIElement)El).Rect.Y + 8, tSlot.Rect.Width * ts.Days, 19); tAreaEl.ChildElements.Add(line); } } } }
public void AfterCreateChildElements(UIElement parent) { 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;
if (El != null && El.GetType() == typeof(TaskUIElement)) { MyTask mt = El.Task as MyTask; if (mt != null && mt.MySubTask.Count > 0) { foreach (Task item in mt.MySubTask) {
TimeSpan ts = item.StartDateTime - mt.StartDateTime; TaskUIElement tb = new TaskUIElement(tAreaEl, item); tb.Rect = new Rectangle(((TaskUIElement)El).Rect.X + (mt.Duration.Days * tSlot.Rect.Width * ts.Days), ((TaskUIElement)El).Rect.Y, tSlot.Rect.Width * item.Duration.Days, 19); tAreaEl.ChildElements.Add(tb);
TaskDependencyLineUIElement line = new TaskDependencyLineUIElement(tAreaEl, item, mt, TaskDependencyType.FinishToStart, Orientation.Horizontal); line.Rect = new Rectangle(((TaskUIElement)El).Rect.X + (mt.Duration.Days * tSlot.Rect.Width), ((TaskUIElement)El).Rect.Y + 8, tSlot.Rect.Width * ts.Days, 19); tAreaEl.ChildElements.Add(line); } } } }
Please let me know if you think that I misunderstood your scenario or if you have any questions.