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.
Unfortunately, activation email could not send to your email. Please try again.

Gantt - Alternative color for days

Thread ID:

Created:

Updated:

Platform:

Replies:

119545 Jul 7,2015 05:08 AM Jul 8,2015 08:36 AM WPF 1
loading
Tags: GanttControl
Yoann Bulourde
Asked On July 7, 2015 05:08 AM

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

Suresh S [Syncfusion]
Replied On July 8, 2015 08:36 AM

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


CONFIRMATION

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.

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.

;