|
In ViewModel class
this.ScheduleSource1 = new ObservableCollection<GanttScheduleRowInfo>
{
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Years, CellTextFormat = "yyyy" },
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Months, CellTextFormat = "MMMM" },
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Days, PixelsPerUnit = 20 }
}; |
|
In MainWindow.xaml.cs
private void GanttControl_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args)
{
if (args.CurrentCell.CellTimeUnit == TimeUnit.Days)
{
// To show only the first letter of the day.
args.CurrentCell.Content = args.CurrentCell.CellDate.ToString("ddd").Substring(0,1).ToLower();
}
} |
|
In ViewModel.cs
this.ScheduleSource3 = new ObservableCollection<GanttScheduleRowInfo>
{
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Years, CellTextFormat = "yyyy" },
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Months, CellTextFormat = "MM", CellsPerUnit = 3 },
new GanttScheduleRowInfo { TimeUnit = TimeUnit.Days, CellTextFormat = "dd MMM", PixelsPerUnit = 20, CellsPerUnit = 3 }
}; |
|
private void GanttControl_ScheduleCellCreated_1(object sender, ScheduleCellCreatedEventArgs args)
{
if (args.CurrentCell.CellTimeUnit == TimeUnit.Days)
{
args.CurrentCell.Content = args.CurrentCell.CellDate.DayOfYear;
}
string content = args.CurrentCell.Content.ToString();
if (content.Substring(0, 1) == "0")
{
args.CurrentCell.Content = content.Substring(1, content.Length - 1);
}
} |