Home Forums WinForms controls Xceed Grid for WinForms Alternating the color of datarows.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17794 |

    You can use the DataRowTemplateStyles property or a StyleSheet to alternate the appearance of the DataRows.

    Using the DataRowTemplatesStyles

    gridControl1.DataRowTemplateStyles.Add( new VisualGridElementStyle() );

    gridControl1.DataRowTemplateStyles.Add( new VisualGridElementStyle() );

    gridControl1.DataRowTemplateStyles[ 0 ].BackColor = Color.Blue;

    gridControl1.DataRowTemplateStyles[ 1 ].BackColor = Color.Red;

    Using the StyleSheet

    Dim styleSheet As New StyleSheet()

    styleSheet.DataRows.Add(New VisualGridElementStyle())
    styleSheet.DataRows.Add(New VisualGridElementStyle())

    styleSheet.DataRows(0).BackColor = Color.Pink
    styleSheet.DataRows(1).BackColor = Color.Green

    ‘ Don’t forget to call the grid’s ApplyStyleSheet
    ‘ method so that the new styles are reflected
    ‘ in the grid.
    GridControl1.ApplyStyleSheet(styleSheet)

    For more information, you can refer to theDataRowTemplate Stylestopic in the help file

    Imported from legacy forums. Posted by Xceed admin (had 1885 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.