Colorize row between two IosMobileTable

Hello everyone,

I have two IOSMobileTable.
The first one is fed by a database (loaded by code and not by a DataSource).

When I click on the row of the first one, I select the row and with a button I add this row on the second one.

What would be the best approach for this row in the first table to change color (perhaps via SetBackGroundColorXC?) and keep it even if another row is selected and added?

I answer to myself and post for the community:

Public Sub ColorizeRow()
  var cell as MobileTableCellData = Table1.RowCellData(0,Table1.SelectedRow.Right)
  cell.SetBackgroundColorXC(color.RGB(220,220,220))
  cell.SetSelectedBackgroundColorXC(color.RGB(220,220,220))
End Sub
Public Sub UncolorizeRow()
  var cell2 as MobileTableCellData = Table2.RowCellData(0,Table2.SelectedRow.Right)
  
  for i  as integer = 0 to Table1.RowCount-1
    
    var cell1 as MobileTableCellData = Table1.RowCellData(0,i)
    
    if cell2.Tag=cell1.Tag then
      Table1.SelectRowXC(0,i)
      cell1.SetSelectedBackgroundColorXC(color.White)
      cell1.SetBackgroundColorXC(color.White)
    end if
    
  next
End Sub

I call ColorizeRow() with an “Add” Button, and UncolorizeRow() with a “Delete” Button.

Must be performed before the Addrow() and the RemoveRowAt()

Have a nice day

1 Like