October 23, 2020, 08:46:25 AM

See more Support incidents in our old archived forum.

Author Topic: Horizontal Lines in Gantt Area  (Read 2643 times)

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Horizontal Lines in Gantt Area
« on: November 24, 2014, 03:40:14 PM »
Hi,

Quick question this time :)

Is it possible to add horizontal lines in the Gantt Area dividing each team like in the in the following example:



Kind regards,
Michael

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 89
Re: Horizontal Lines in Gantt Area
« Reply #1 on: November 25, 2014, 07:15:03 PM »
Michael,

You can setup borders like this:

// First listen to GanttControl's TemplateApplied event:
        void ganttControl_TemplateApplied(object sender, EventArgs e)
        {
            this.ganttControl.GanttChart.LoadingRow += GanttChart_LoadingRow;
        }

        void GanttChart_LoadingRow(object sender, GanttChartRowEventArgs e)
        {
            GanttTaskItemBar bar = e.Row as GanttTaskItemBar;
            // Wait till it's loaded:
            bar.Loaded += bar_Loaded;
        }
        // Insert a Border to render a bottom border for each row.
        void bar_Loaded(object sender, RoutedEventArgs e)
        {
            GanttTaskItemBar bar = sender as GanttTaskItemBar;
            Canvas topCanvas = Extensions.GetChild<Canvas>(bar, true);

            Border rowBorder = new Border();
            rowBorder.BorderThickness = new Thickness(0, 0, 0, 1);
            rowBorder.BorderBrush = new SolidColorBrush(Colors.LightGray);
            Canvas.SetZIndex(rowBorder, -3);

            Binding binding = new Binding("ViewWidth");
            binding.Source = bar;
            rowBorder.SetBinding(WidthProperty, binding);

            binding = new Binding("Height");
            binding.Source = bar;
            rowBorder.SetBinding(HeightProperty, binding);

            topCanvas.Children.Add(rowBorder);
        }

Thanks
Support

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 89
Re: Horizontal Lines in Gantt Area
« Reply #2 on: November 26, 2014, 06:26:47 PM »
Michael,

Our previous update is actually for our GanttControl. In fact, we made it a bit easier to do add borders with a different API like this (this API will be in our next version):

Code: [Select]
        // Listen to ganttControl TemplateApplied event.
        void ganttControl_TemplateApplied(object sender, EventArgs e)
        {
            this.ganttControl.GanttChart.LoadingRow += GanttChart_LoadingRow;
        }
        void GanttChart_LoadingRow(object sender, GanttChartRowEventArgs e)
        {
            GanttTaskItemBar bar = e.Row as GanttTaskItemBar;
            bar.AddBottomBorder(1, Colors.LightGray);
        }

And for FlexyGantt, you can do something similar like this:

Code: [Select]
        // Listen to FlexyGantt's TemplateApplied event.
        void fxgantt_TemplateApplied(object sender, EventArgs e)
        {
            this.fxgantt.GanttChart.LoadingRow += GanttChart_LoadingRow;
        }
        void GanttChart_LoadingRow(object sender, GanttChartRowEventArgs e)
        {
            TasksListControl row = e.Row as TasksListControl;
            row.AddBottomBorder(1, Colors.LightGray);
        }

We will send you the updated assembly by email.

Thanks
RadiantQ Support

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Horizontal Lines in Gantt Area
« Reply #3 on: November 28, 2014, 09:53:22 AM »
Works nicely ;D

Many thanks,
Michael