Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
Dim ExtraSize As Int = 15
Dim su As StringUtils
Dim text1 As String
Dim cd2 As ColorDrawable
cd2.Initialize(Colors.RGB(255,255,255),0dip)
'we need to add the panel to a parent to set its dimensions. It will be removed after the layout is loaded.
If Timer1.Interval>0 And Timer1.Enabled=False Then Return
Log("MAX: "&Max(0, FirstIndex - ExtraSize))
Log("MIN: "&Min(LastIndex + ExtraSize, CustomListView1.Size - 1))
For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, CustomListView1.Size - 1)
Dim p As Panel = CustomListView1.GetPanel(i)
If p.NumberOfViews = 0 Then
Dim cd As ZendingData = CustomListView1.GetValue(i)
'**************** this code is similar to the code in CreateItem from the original example
p.LoadLayout("LM_TeBezorgenCell")
text1 = cd.Text1 & CRLF & cd.Text2 & CRLF & cd.Text3
p.Background = cd2
oCLV_List.Text =text1
p.Height=su.MeasureMultilineTextHeight(oCLV_List,text1)
oCLV_List.Height=p.Height
CustomListView1.ResizeItem(i,p.Height)
End If
Next
CustomListView1.AsView.Visible = True
End Sub