Hello ... I've scoured the forums for an answer to this seemingly simple request. I have a template setup and it's working great. What I want to do is to 'paint' the color of the bounding box, for the child rows, the same color as their 'parent' row. I know I need to use ViewCellFormatting to achieve the painting of the box but I can't figure out how to get the row color (I'm using Conditional Formatting to color the parent rows) from the parent during the ViewCellFormatting event. The CellFormattingEventArgs only seems to expose the HierarchicalRowInfo object which, if I'm correct in my understanding, represents the Logical tree and the color of the row is from the Visual tree so I need the actual RowElement object representing the parent row. Below is the code for painting my bounding box:
As you can see, I'm using VB.NET but I can always translate C#. I want to replace the Color.GreenYellow with something like e.CellElement.Parent.BackColor. The problem is that the parent is the ScrollableRowsContainer element, not the GridDetailViewRowElement that I'm trying to get. How the heck can I achieve this?
Thanks, Jim
If
TypeOf
e.CellElement
Is
GridDetailViewCellElement
Then
Dim
row
As
GridRowElement = e.CellElement.Parent 'This line doesn't actually retrieve the BackColor of the Parent!!!!!!
e.CellElement.DrawFill =
True
e.CellElement.BackColor = Color.GreenYellow
e.CellElement.Padding =
New
Padding(9, 4, 3, 4)
e.CellElement.Margin =
New
Padding(10, 0, 0, 0)
e.CellElement.Parent.
End
If