This is a migrated thread and some comments may be shown as answers.

TextViewCellFormatting - Backcolor Row

2 Answers 63 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 15 Dec 2014, 05:13 PM
Hello,
I want to change the background color of a row if the progress is 100%.
Foreground color is changeable background color not.
What am I doing wrong?

regards
Frank

   Private Sub rGanttProjekteliste_TextViewCellFormatting(sender As Object, e As GanttViewTextViewCellFormattingEventArgs) _
                                                                        Handles rGanttProjekteliste.TextViewCellFormatting
        '
        Dim headercelltyp As Type = GetType(GanttViewTextViewHeaderCellElement)
        Dim elementcelltyp As Type = e.CellElement.GetType()
        '
        If Not headercelltyp.IsAssignableFrom(elementcelltyp) Then
            '
            If e.Item.Level = 1 Then
                e.CellElement.Font = New Font(e.CellElement.Font, FontStyle.Bold)
            End If
            '
            If e.Item.Progress = 100 Then
                e.CellElement.BackColor = Color.Gray
            Else
                e.CellElement.BackColor = Color.White
            End If
            '
        End If
        '
    End Sub

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Dec 2014, 10:21 AM
Hello Frank,

Thank you for writing.

In the TextViewCellFormatting event it is necessary to set the DrawFill property to true in order to obtain the correct coloring. You can refer to our GanttView >> TextView item formatting help article which is quite useful on this topic.

Note that Font creation is a heavy operation and it is not recommended to be performed in the formatting event which is fired a lot of times. I would recommend you to create the font just once and use the font variable in the TextViewCellFormatting event.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Frank
Top achievements
Rank 1
answered on 16 Dec 2014, 03:14 PM
Thank you for your help
Tags
GanttView
Asked by
Frank
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Frank
Top achievements
Rank 1
Share this question
or