PaintCellBackground not firing whole row

i want to color a row when a checkbox is checked (in paintcellbackground)

if me.LastRowIndex>0 then
  
  if me.CellCheckBoxStateAt(row,0)=DesktopCheckBox.VisualStates.Checked then
    
    g.DrawingColor = &cD2FFF3
    g.FillRectangle(0, 0, g.Width, g.Height)
    list.RefreshCell(row,-1)
    
  end if 
  
end if

but it is only coloring the cell with the checkbox, only when i resize the window it is coloring the whole row.

the docu says:
If you pass a -1 as the row or column parameter, it will redraw the specified entire row or column

but is does not…

Move the

list.RefreshCell(row,-1)

into the clicked event and let the paint happen.

Never call something from a paint that can cause a recursive loop

thanks!

Shouldn’t that be

if row<= me.LastRowIndex then

You should be checking the CellCheckBoxState of rows that don’t exist. You’ll get an exception.