We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Gantt - Alternative color for days

Thread ID:





119545 Jul 7,2015 09:08 AM UTC Jul 8,2015 12:36 PM UTC WPF 1
Tags: GanttControl
Yoann Bulourde
Asked On July 7, 2015 09:08 AM UTC


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

Attachment: GanttStripLine_e3d20aab.zip

Suresh S [Syncfusion]
Replied On 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.

private void Gantt_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args)


      DateTime currentDate = args.CurrentCell.CellDate;

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


         var z = currentDate.Day % 2;


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


           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.
 Suresh S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon