RowStyles behaviour
Hi
In my attached sample I would like the rowstyle (background colour etc.) to be applied to the entire row (including column 0). I have tried many variations of setting Cols.HeaderCount / Properties.RowHeaders however cannot find a solution.
I don't think that I need any row headers, hence have set Cols.HeaderCount = -1. I do need frozen columns though.
What am I missing here?
thanks
Richard
GridStyleSample.zip
In my attached sample I would like the rowstyle (background colour etc.) to be applied to the entire row (including column 0). I have tried many variations of setting Cols.HeaderCount / Properties.RowHeaders however cannot find a solution.
I don't think that I need any row headers, hence have set Cols.HeaderCount = -1. I do need frozen columns though.
What am I missing here?
thanks
Richard
GridStyleSample.zip
SIGN IN To post a reply.
4 Replies
HA
haneefm
Syncfusion Team
June 18, 2007 03:45 PM UTC
Hi Richard,
You can change the style setting of the cell using the PrepareViewStyleInfo event of the grid. Below is a code snippet
Private Sub GridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles GridControl1.PrepareViewStyleInfo
If (e.ColIndex = 0) Then
e.Style.BackColor = Me.GridControl1.Model.Item(e.RowIndex, e.ColIndex + 1).BackColor
End If
End Sub
Best regards,
Haneef
You can change the style setting of the cell using the PrepareViewStyleInfo event of the grid. Below is a code snippet
Private Sub GridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles GridControl1.PrepareViewStyleInfo
If (e.ColIndex = 0) Then
e.Style.BackColor = Me.GridControl1.Model.Item(e.RowIndex, e.ColIndex + 1).BackColor
End If
End Sub
Best regards,
Haneef
RB
Richard Bysouth
June 19, 2007 02:01 AM UTC
Thanks Haneef - that fixes the issue. FYI the code I used was slightly different as I needed the whole style:
Private Sub GridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles GridControl1.PrepareViewStyleInfo
If (e.ColIndex = 0) AndAlso Me.GridControl1.RowStyles(e.RowIndex).IsEmpty = False Then
'copy style from the row to cells in column 0.
e.Style.CopyFrom(Me.GridControl1.RowStyles(e.RowIndex))
End If
End Sub
Private Sub GridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles GridControl1.PrepareViewStyleInfo
If (e.ColIndex = 0) AndAlso Me.GridControl1.RowStyles(e.RowIndex).IsEmpty = False Then
'copy style from the row to cells in column 0.
e.Style.CopyFrom(Me.GridControl1.RowStyles(e.RowIndex))
End If
End Sub
RB
Richard Bysouth
June 20, 2007 12:10 AM UTC
Actually I've found a problem with this - for some reason if I use Style.CopyFrom, the text is not displayed. If I set the style properties individually (BackColor, Borders etc.), it displays fine.
Any ideas why this wouldn't work?
Any ideas why this wouldn't work?
HA
haneefm
Syncfusion Team
June 20, 2007 09:54 PM UTC
Hi Richard,
Here is a forum thread that discuss with the similar task.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=21184
Best regards,
Haneef
Here is a forum thread that discuss with the similar task.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=21184
Best regards,
Haneef
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
RB Richard Bysouth
- Jun 18, 2007 01:58 AM UTC
- Jun 20, 2007 09:54 PM UTC