Search code examples
objectlistview

Background color row in ObjectListView filtered by cell value - VB.NET WinForms


Good afternoon,

It's being complicated to solve the problem that i am facing.

I have a ObjectListView filled and need to distinguish the rows that have a specific value in a cell.

So, if the cell as a value of 1 -> yellow row, value of 2 -> orange row, and so on..

I used the default ObjectListView control provided, no code used.

What is the best way to do that?

Thank you!


Solution

  • The documentation on their site includes a very similar example through configuring a handler for the FormatRow event.

    OLV Recipes

    In my testing, however, I found that the event wasn't firing when I only used the SetObjects() method. I was able to get the event to work correctly after also calling RefreshObjects().

    Reviewing their code: SetObjects() never calls PostProcessOneRow(). I'm not sure if this is intentionally left out or a bug.