Search code examples
vb.netwinformsxtragrid

changing backcolor of the XtraGridView cell


HEllo friends

I want to change the background color of the DevXpress's XtraGridView's particular cell.

And the cell must be current focused cell.

How to do this? can anybody help me in resolving this problem?

thanx..


Solution

  • This link should help

    http://documentation.devexpress.com/#WindowsForms/CustomDocument758

    In the example, I would look at this particular code.

    Imports DevExpress.XtraGrid.Views.Grid

    Private Sub GridView1_RowStyle(ByVal sender As Object, _
    ByVal e As DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs) Handles GridView1.RowStyle
        Dim View As GridView = sender
        If (e.RowHandle >= 0) Then
            Dim category As String = View.GetRowCellDisplayText(e.RowHandle, View.Columns("Category"))
            If category = "Beverages" Then
                e.Appearance.BackColor = Color.Salmon
                e.Appearance.BackColor2 = Color.SeaShell
            End If
        End If
    End Sub
    

    This code seemed to help the situation of helping the programming change the backcolor of two categoris of Bevarage.

    Please comment if I made a mistake