Skip to main content

GanttControl.WorkWeek Property

Provides access to a rule that specifies work hours for a workweek.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.2.dll

Declaration

[DXCategory("Behavior")]
public WorkWeekRule WorkWeek { get; }

Property Value

Type Description
WorkWeekRule

An object that specifies work hours for a workweek.

Remarks

The WorkWeek property provides access to the workweek schedule. The default workweek is from Monday to Friday. Work hours are 8:00 to 17:00 with a break between 12:00 and 13:00.

To customize the schedule in the Visual Studio Designer, click Edit Work Week Schedule in the control’s smart tag menu (or click Run Designer and navigate to the Work Week Schedule section). You can specify the schedule for each day of the week.

image

The upper bound is not included in the working hours. For example, if the working time is until noon, 12:00 PM is not working time, but the time a moment (tick) earlier, remains the working time.

Note

The specified work hours are automatically sorted. If the specified work hours overlap each other, they are automatically merged.

Example

The code below shows how to change work hours for Wednesday and make Monday a day off.

// Add Monday as a non-work day.
ganttControl1.WorkWeek.Add(new WorkDayOfWeek(DayOfWeek.Monday, true));

// Work hours for Wednesday are 9:00 to 17:30
// with a break between 12:00 and 13:30.
WorkTime wednesdayMorningWorkTime = new WorkTime(9, 12);
WorkTime wednesdayAfternoonWorkTime = new WorkTime(new TimeSpan(13, 30, 00), new TimeSpan(17, 30, 00));
WorkDayOfWeek wednesday = new WorkDayOfWeek(DayOfWeek.Wednesday, wednesdayMorningWorkTime, wednesdayAfternoonWorkTime);
ganttControl1.WorkWeek.Add(wednesday);
See Also