Gantt - Alternative color for days

Hello,

We need to distinct day lines on the gantt control, with alternative color for exemple.

I first tried StripLineInfo with RepeatFor property = 2, but NonWorkingDay striplines are erase.

I force to re-create NonWorkingDay in StipLineCollection. This solution works.
But if I change my Gantt Period (Change StartTime for exemple), all StripLines move with the period (I add screen capture with exemple).

2 Questions :
- Do you have an alternative solution at striplines for apply alternative days color.
- Does it have event for detect StartTime / End Time event ?

Thank You in advance
Y.

Attachment: GanttStripLine_e3d20aab.zip

1 Reply

SS Suresh S Syncfusion Team July 8, 2015 12:36 PM UTC

Hi Yoann,
Thanks for contacting Syncfusion support.
Query 1: (customize schedule)
We can achieve this requirement by applying alternate background for days by using ScheduleCellCreated event as shown in below code.
CodeSnippet:

private void Gantt_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args)

{

      DateTime currentDate = args.CurrentCell.CellDate;


      if (args.CurrentCell.CellTimeUnit == TimeUnit.Days)

      {

         var z = currentDate.Day % 2;


         if(z==0)

           args.CurrentCell.Background = new SolidColorBrush(Colors.Red);

         else

           args.CurrentCell.Background = new SolidColorBrush(Colors.Green);

               

      }
}
Query 2: (start/end time)
We can achieve this requirement by using NodeCreated event as shown in below code,
Code Snippet:

private void Gantt_NodeCreated(object sender, NodeCreatedEventArgs args)

        {

            var starttime = args.Node.StartTime;

            var endtime = args.Node.EndTime;
        }
Also, we have created a sample regarding this, please download from below location.
Sample: Predecessors
Please let us know in case of any query.
Regards,
 Suresh S


Loader.
Up arrow icon