GanttView for WPF | ComponentOne
In This Topic
    Custom Field Styles
    In This Topic

    GanttView provides users the ability to customize the style and appearance of tasks fields in order to match with the user interface requirements of an application. Users can format the fields in the grid view by using various properties of the FieldStyle class such as Field, FieldName, FontStyle, ForegroundColor, BackgroundColor, and Underline.

    The following image shows a GanttView with custom styles applied to the fields.

    Custom Field Styles

    The following code illustrates how to apply custom styles to fields. This example uses the sample created in the Quick start.

    Dim fs As New FieldStyle()
    fs.Field = StyleField.All
    fs.ForegroundColor = System.Windows.Media.Colors.Brown
    fs.BackgroundColor = System.Windows.Media.Colors.BlanchedAlmond
    fs.FieldName = "Task Name"
    fs.FontStyle = FontStyles.Italic
    For Each task As Task In gv.Tasks
        Dim fsc As FieldStyleCollection = task.FieldStyles
        fsc.Add(fs)
    Next
    
    FieldStyle fs = new FieldStyle();
    fs.Field = StyleField.All;
    fs.ForegroundColor = System.Windows.Media.Colors.Brown;
    fs.BackgroundColor = System.Windows.Media.Colors.BlanchedAlmond;
    fs.FieldName = "Task Name";
    fs.FontStyle = FontStyles.Italic;
    foreach (Task task in gv.Tasks)
    {
        FieldStyleCollection fsc = task.FieldStyles;
        fsc.Add(fs);
    }