Category / Section
How to customize the Gantt grid row in the WPF GanttControl
1 min read
This article explains how to customize the Gantt grid row in Syncfusion WPF Gantt control, as shown in the following image.
To customize the row height of the GanttGrid
This can be achieved by using the RowHeight property of the GanttControl as shown in the following code sample.
… ganttControl = new GanttControl { ItemsSource = (this.DataContext as ViewModel).TaskDetails, RowHeight = 60 }; …
To hide the Gantt grid row lines
By using the QueryCellInfo event, you can set the border color of the event argument style as shown in the following code sample.
… ganttControl.Loaded += GanttControl_Loaded; … private void GanttControl_Loaded(object sender, RoutedEventArgs e) { ganttControl.GanttGrid.Model.QueryCellInfo += this.Model_QueryCellInfo; ganttControl.GanttGrid.InternalGrid.InvalidateCells(); } private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { var lightpen = new Pen (e.Style.Background, 0); e.Style.Borders.Right = lightpen; e.Style.Borders.Left = lightpen; e.Style.Borders.Bottom = lightpen; e.Style.Borders.Top = lightpen; }
To customize the Gantt grid font style
This can be achieved by setting the font style in the QueryCellInfo event argument as shown in the following code sample.
private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { e.Style.Foreground = new SolidColorBrush(Colors.Green); System.Windows.Media.FontFamily fontFamily = new System.Windows.Media.FontFamily("Comic Sans MS"); e.Style.Font = new GridFontInfo() { FontSize = 10, FontFamily = fontFamily, FontStyle = FontStyles.Italic }; }
View the sample in the GitHub.
See also
How to add custom tooltip to Gantt
How to define your own schedule for Gantt to track the progress of projects
How to differentiate the dates of holidays