StrataFrame Forum

ListView and Cell Colors

http://forum.strataframe.net/Topic22858.aspx

By Bill Cunnien - 4/22/2009

I searched these forums but could not find an answer...it has probably been covered already, so I apologize for the duplicate question.



My ListView shows a due date for a packing list item. I would like the due date to appear red in the ListView if the due date is before the ship date on the packing list. How do I isolate the cell in order to make the foreground color set to red?



Thanks,

Bill
By Edhy Rijo - 4/22/2009

Hi Bill,

I don't think the ListView supports that. What you can do is handle the condition in the ListView.RowPopulating() event and change the color of the whole row or add/change an icon in that row.





Private Sub lstContacts_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles lstContacts.RowPopulating

Dim bo As bizContacts = DirectCast(e.BusinessObject, bizContacts)



e.UseGroup = True



'-- Show the Inactive Status with a friendly text

If bo.RequestServiceAuthorized Then

e.GroupHeaderText = "Request Service Authorized"

e.RowForeColor = Color.Green

Else

e.GroupHeaderText = "Non-Authorized"

End If



'-- If inactive, set the forecolor red.

If bo.ContactIsInactive = True Then

e.RowForeColor = Color.Red

End If

End Sub

By Bill Cunnien - 4/22/2009

Ok...I can get the whole row to work. Too bad a cell cannot be singled out. One day, when I have a little extra time, I will replace that ListView with the EnhancedListView. That'll give me what I am looking for, I'm sure.



Thanks, Edhy!

Bill
By Edhy Rijo - 4/22/2009

Glad it worked for you too.