Thanks for the pointers - I got it working!
For everyone else, here is the implementation to save you some time if you want to do the same:
Private Function GetNodeRow(ByVal node As NodeBase) As DataRowView
Try
Dim parent As NodeBase = node.Parent
If (TypeOf parent Is VirtualRootNode) Then
Dim drv() As DataRowView
drv = selfRelatedDt.DefaultView.FindRows(New Object() {0, node.Index + 1})
If drv.Length > 0 Then
'Added to style assembly nodes - EAP 3/16/2006
StyleNode(node, drv(0))
Return drv(0)
End If
Else
Dim parentNodeRow As DataRowView = GetNodeRow(parent)
If (Not parentNodeRow Is Nothing) Then
Dim parentId As Integer = CType(parentNodeRow("Id"), Integer)
Dim drv() As DataRowView
drv = selfRelatedDt.DefaultView.FindRows(New Object() {parentId, node.Index + 1})
If drv.Length > 0 Then
'Added to style assembly nodes - EAP 3/16/2006
StyleNode(node, drv(0))
Return drv(0)
End If
End If
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
'Added to style nodes - EAP 3/16/2006
Private Sub StyleNode(ByVal node As CoolNode, ByVal drv As DataRowView)
If Not drv Is Nothing Then
If drv.Item("PDMCheckout") = "No" Then
node.BackColor = Color.LightGray
node.ForeColor = Color.Black
ElseIf drv.Item("IsSumNode") = "True" Then
node.BackColor = Color.DodgerBlue
node.ForeColor = Color.Navy
ElseIf drv.Item("FileLocation").ToString.Substring(Len(drv.Item("FileLocation").ToString) - 3, 3).ToLower = "asm" Then
node.BackColor = Color.Goldenrod
node.ForeColor = Color.DarkGreen
End If
End If
End Sub
Private Function grid_VirtualMode_InitNewNode(ByVal sender As Object, ByVal parent As NodeBase, ByVal index As Integer) As NodeBase
Dim StyledNode As CoolNode = New CoolNode(parent)
Return StyledNode
End Function
Class CoolNode
Inherits VirtualNode
Implements IStyledNode
Private _backColor As Color = Color.Empty
Public Sub New(ByVal parent As NineRays.Windows.Forms.Data.NodeBase)
MyBase.New(parent)
End Sub
Public Property BackColor() As Color
Get
Return _backColor
End Get
Set(ByVal Value As Color)
If (Not _backColor.Equals(Value)) Then
_backColor = Value
Me.OnChange()
End If
End Set
End Property
Private _foreColor As Color = Color.Empty
Public Property ForeColor() As Color
Get
Return _foreColor
End Get
Set(ByVal Value As Color)
If (Not _foreColor.Equals(Value)) Then
_foreColor = Value
Me.OnChange()
End If
End Set
End Property
Public Sub OnBeginPaint(ByVal info As NineRays.Windows.Forms.Grids.CellDrawInfo) Implements NineRays.Windows.Forms.Data.IStyledNode.OnBeginPaint
If Not (info.cellSelected) Then
info.customForeColor = _foreColor
info.customBackColor = _backColor
Return
End If
End Sub
Public Sub OnEndPaint(ByVal info As NineRays.Windows.Forms.Grids.CellDrawInfo) Implements NineRays.Windows.Forms.Data.IStyledNode.OnEndPaint
'clear custom colors
info.customForeColor = Color.Empty
info.customBackColor = Color.Empty
End Sub
End Class