June 21, 2018, 08:59:04 AM

See more Support incidents in our old archived forum.

Author Topic: Vertical lines same as TimeScaleHeader  (Read 1055 times)

Marlene.Witsch

  • Customers
  • Newbie
  • *
  • Posts: 9
Vertical lines same as TimeScaleHeader
« on: October 31, 2016, 12:11:35 PM »
Is there a way to add vertical lines same as the spacing of the lowest TimeScaleHeader?



So I currently only have the gray line and would also like to have the red lines as gray grid lines.

Best regards,
Marlene

EDIT: I would like this in flexygantt
« Last Edit: October 31, 2016, 12:13:44 PM by Marlene.Witsch »

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 96
Re: Vertical lines same as TimeScaleHeader
« Reply #1 on: November 02, 2016, 02:19:39 PM »
Marlene,

Yes, you can add special lines as vertical lines as you requested. This is already illustrated it for week headers in our "Samples\Common\DynamicSpecialLines" sample from our install.

Please replace "GenerateGridLines" method with below code in that sample to show the lines for day headers as well.

Code: [Select]
private SpecialLineInfo[] GenerateGridLines()
{
    // If the week-header is the only header that's visible (then it will be the bottom most header)
    TimeScaleHeaderDefinition bottomHeaderDefn = this.ganttControl.BottomTwoHeaders[0];
    if (bottomHeaderDefn != null)
    {
        List<TimeSpanHeader> headerList = new List<TimeSpanHeader>();
        // Grab hold of the TimeSpanHeader corresponding to the Weeks header.
        Extensions.GetChildren<TimeSpanHeader>(this.ganttControl.GanttChart.TimeSpanHeaders, ref headerList, false, true);
        TimeSpanHeader bottomHeader = null;
        foreach (TimeSpanHeader header in headerList)
        {
            if (header.HeaderInfo.Type == bottomHeaderDefn.Type)
            {
                bottomHeader = header;
                break;
            }
        }
        // Based on the TimeUnits in the header, generate the SpecialLineInfos.
        TimeUnits timeUnits = bottomHeader.ItemsSource as TimeUnits;
        List<SpecialLineInfo> gridLines = new List<SpecialLineInfo>();

        foreach (TimeUnit timeUnit in timeUnits)
        {
            gridLines.Add(new SpecialLineInfo() { LineDateTime = (DateTime)timeUnit.Tag, LineBrush = new SolidColorBrush(Colors.LightGray), ToolTipText = ((DateTime)timeUnit.Tag).ToString() });
        }
        return gridLines.ToArray<SpecialLineInfo>();
    }
    else
        return null;
}

Thanks,
- Raja.

Marlene.Witsch

  • Customers
  • Newbie
  • *
  • Posts: 9
Re: Vertical lines same as TimeScaleHeader
« Reply #2 on: November 03, 2016, 12:42:15 PM »
Hm... But the special lines overlap over the bars... not like the gridlines

Rajagopal

  • RQ Members
  • Jr. Member
  • *
  • Posts: 96
Re: Vertical lines same as TimeScaleHeader
« Reply #3 on: November 04, 2016, 09:58:04 AM »
Marlene,

Changing the "ZIndex" value as "-1" will make special lines not to overlap over the task bars. We will consider to support this feature in source level as per request in future.

Code: [Select]
<Style TargetType="{x:Type srcview:SpecialLines}">
    <Setter Property="Canvas.ZIndex" Value="-1"></Setter>
</Style>

Thanks,
- Raja.

Marlene.Witsch

  • Customers
  • Newbie
  • *
  • Posts: 9
Re: Vertical lines same as TimeScaleHeader
« Reply #4 on: November 07, 2016, 01:49:41 PM »
Ah thank you for that info :)

Regards,
Marlene