如何使用devexpress根据某些列值更改行颜色?
How to change the row color based on certain column values with devexpress?
我有一个 Devexpress gridview。我需要根据多列中的某些值更改整行的颜色。我有一个类别列、onHand 列和一个 TrackLevel 列。颜色设置如下:
股票跟踪级别为白色的股票项目
库存项目无库存轨道水平:Pienk/maroon/red(取决于屏幕质量)
服务项目跟踪级别关闭:蓝色 - 如果类别标记为服务
服务项目跟踪级别:Pienk/maroon/red(取决于屏幕质量)– 如果类别标记为服务
服务项目跟踪级别关闭:Pienk/maroon/red(取决于屏幕质量)– 如果类别未标记为服务
分组库存商品:绿色
库存项目轨道水平关闭:黄色
我可以使用 Devexpress Designer,但它不允许我评估多列的值。
我访问过https://supportcenter.devexpress.com/ticket/details/t621755/change-the-color-of-a-row-or-cell但是我输入的时候没有RowStyleEventArgs
我处理了 gridview.rowstyle 事件并且成功了。示例代码如下:
Private Sub MyGridView_RowStyle(ByVal sender As Object, ByVal e As RowStyleEventArgs) Handles GridView1.RowStyle
Dim category As Integer = Convert.ToInt32(GridView1.GetRowCellValue(e.RowHandle, "CategoryID"))
If category = 1 Then
e.Appearance.BackColor = Color.Red
Else
e.Appearance.BackColor = Color.LightGreen
End If
e.HighPriority = True 'override any other formatting
End Sub
我有一个 Devexpress gridview。我需要根据多列中的某些值更改整行的颜色。我有一个类别列、onHand 列和一个 TrackLevel 列。颜色设置如下:
股票跟踪级别为白色的股票项目
库存项目无库存轨道水平:Pienk/maroon/red(取决于屏幕质量)
服务项目跟踪级别关闭:蓝色 - 如果类别标记为服务
服务项目跟踪级别:Pienk/maroon/red(取决于屏幕质量)– 如果类别标记为服务
服务项目跟踪级别关闭:Pienk/maroon/red(取决于屏幕质量)– 如果类别未标记为服务
分组库存商品:绿色
库存项目轨道水平关闭:黄色
我可以使用 Devexpress Designer,但它不允许我评估多列的值。
我访问过https://supportcenter.devexpress.com/ticket/details/t621755/change-the-color-of-a-row-or-cell但是我输入的时候没有RowStyleEventArgs
我处理了 gridview.rowstyle 事件并且成功了。示例代码如下:
Private Sub MyGridView_RowStyle(ByVal sender As Object, ByVal e As RowStyleEventArgs) Handles GridView1.RowStyle
Dim category As Integer = Convert.ToInt32(GridView1.GetRowCellValue(e.RowHandle, "CategoryID"))
If category = 1 Then
e.Appearance.BackColor = Color.Red
Else
e.Appearance.BackColor = Color.LightGreen
End If
e.HighPriority = True 'override any other formatting
End Sub