/// <summary> /// Handles the ScheduleCellCreated event of the GanttControl /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="args">The <see cref="Syncfusion.Windows.Controls.Gantt.ScheduleCellCreatedEventArgs"/> instance containing the event data.</param> void AssociatedObject_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args) { DateTime currentDate = args.CurrentCell.CellDate; if (args.CurrentCell.CellTimeUnit == TimeUnit.Months) { args.CurrentCell.Foreground = new SolidColorBrush(Colors.White); // Quarter 1 dates contains months below 3. since we are cheking the cell dates and changing the Content of the cell. if (currentDate.Month <= 3) { args.CurrentCell.Content = "Q 1"; args.CurrentCell.CellToolTip = "Quarter 1"; args.CurrentCell.Background = (Brush) new BrushConverter().ConvertFrom("#119EDA"); } // Quarter 2 dates contains months between 4 - 6. since we are cheking the cell dates and changing the Content of the cell. else if (currentDate.Month > 3 && currentDate.Month <= 6) { args.CurrentCell.Content = "Q 2"; args.CurrentCell.CellToolTip = "Quarter 2"; args.CurrentCell.Background = (Brush) new BrushConverter().ConvertFrom("#79B4F9"); } // Quarter 3 dates contains months between 6 - 9. since we are cheking the cell dates and changing the Content of the cell. else if (currentDate.Month > 6 && currentDate.Month <= 9) { args.CurrentCell.Content = "Q 3"; args.CurrentCell.CellToolTip = "Quarter 3"; args.CurrentCell.Background = (Brush) new BrushConverter().ConvertFrom("#119EDA"); } // Quarter 4 dates contains months below 9 - 12. since we are cheking the cell dates and changing the Content of the cell. else if (currentDate.Month > 9 && currentDate.Month <= 12) { args.CurrentCell.Content = "Q 4"; args.CurrentCell.CellToolTip = "Quarter 4"; args.CurrentCell.Background = (Brush) new BrushConverter().ConvertFrom("#79B4F9"); } } }
void AssociatedObject_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args) { args.CurrentCell.Foreground = new SolidColorBrush(Colors.White); }