We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

RowStyles behaviour

Thread ID:

Created:

Updated:

Platform:

Replies:

62522 Jun 18,2007 01:58 AM UTC Jun 20,2007 09:54 PM UTC WinForms 4
loading
Tags: GridControl
Richard Bysouth
Asked On June 18, 2007 01:58 AM UTC

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

haneefm [Syncfusion]
Replied On 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

Richard Bysouth
Replied On 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

Richard Bysouth
Replied On 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?

haneefm [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;