Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
Custom summary rows
posted

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?

Parents Reply Children
No Data