ListBox items change after doing scroll in Firemonkey
<p>I am developing a Multi-Device Application in Firemonkey where Main class has a ListBox component with some items. Each of these items has the same custom style.</p>

<p>My problem is when I have so many items in the ListBox and I have to do scroll vertical to see the rest of items. In this case, the ListBox has a strange behaviour and when I do scroll up after doing scroll down the item's components (a button for example) have changed his background colour and the items have changed his order inside ListBox. </p>

<p>For example, if I had:</p>

<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>

<p>after I do scroll I have:</p>

<ol>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 1</li>
</ol>

<p>This change is random. Each time is different.</p>

<p>Real example (process steps):</p>

<ol>
<li>Load the Main class where is ListBox.</li>
</ol>

<p><a href="https://i.stack.imgur.com/4Evys.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Evys.png" alt="enter image description here"></a></p>

<ol start="2">
<li><p>Do vertical scrolling down to see the rest of items.</p></li>
<li><p>Do vertical scrolling upward to return to the top of the list.</p></li>
</ol>

<p><a href="https://i.stack.imgur.com/lni5I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lni5I.png" alt="enter image description here"></a></p>

<ol start="4">
<li>The items have changed position in the ListBox and the button (component of each item) changes its background color.</li>
</ol>

<p>Why I have this behaviour in the ListBox?? How I can solve it and the ListBox do not change items order neither background colour of his components?</p>

<p>I do not know if there is any property to block items inside ListBox or similar ...</p>

<p><strong>EDIT</strong></p>

<p>This is the code to create and initialize the ListBox items:</p>

<pre><code>procedure TRooms_Form.FormCreate(Sender: TObject);
var
  ...
begin
    i := 0;
    while i &lt; numItems do begin
      //Create ListBox item
       item := TListBoxItem.Create(nil);
       item.Parent := myListBox;
       item.StyleLookup := 'styleLBox';
      //Number
       itemNumber := item.FindStyleResource('btt_number') as TButton;
       if Assigned(itemNumber) then begin
           itemNumber.Text := jsonNumber;
           case jsonColor of
             0 : itemNumber.TintObject.TintColor := TAlphaColors.Chocolate; 
             1 : itemNumber.TintObject.TintColor := TAlphaColors.Gold;      
             2 : itemNumber.TintObject.TintColor := TAlphaColors.Darkgreen; 
             3 : itemNumber.TintObject.TintColor := TAlphaColors.Deeppink;  
           end;
         end;
      //Title
       itemTitle := item.FindStyleResource('txtstyle_title') as TText;
       if Assigned(itemTitle) then begin
         itemTitle.Text := jsonTitle;
       end;
      //Occupation
       itemOccup := item.FindStyleResource('txt_occupation') as TText;
       if Assigned(itemOccup) then begin
         itemOccup.Text := jsonOccup;
       end;
      //Dates
       itemDay := item.FindStyleResource('txt_day') as TText;
       if Assigned(itemDay) then itemDay.Text := displayDay;
       itemDateStart := item.FindStyleResource('txt_start') as TText;
       if Assigned(itemDateStart) then itemDateStart.Text := jsonTimeStart;
       itemDateEnd := item.FindStyleResource('txt_end') as TText;
       if Assigned(itemDateEnd) then itemDateEnd.Text := jsonTimeEnd;
      //Item background
       itemBackgr := item.FindStyleResource('background_item') as TRectangle;
       if Assigned(itemBackgr) then begin
         itemBackgr.Fill.Kind := TBrushKind.Solid;
         case jsonStatus of
           0 : itemBackgr.Fill.Color := TAlphaColors.White;         
           1 : itemBackgr.Fill.Color := TAlphaColors.Lightgreen;    
           2 : itemBackgr.Fill.Color := TAlphaColors.Palegoldenrod; 
           3 : itemBackgr.Fill.Color := TAlphaColors.Lightcoral;    
           4 : itemBackgr.Fill.Color := TAlphaColors.Lightseagreen; 
           5 : itemBackgr.Fill.Color := TAlphaColors.Lightblue;     
           6 : itemBackgr.Fill.Color := TAlphaColors.Lightgrey;     
         end;
       end;
      //Empty item
       if (StrToInt(jsonEmpty) = 1) or (StrToInt(jsonNull) = 1) then begin
         startDetail[i] := False;
         if Assigned(itemNumber) then itemNumber.Visible := False;
         if Assigned(itemOccup) then itemOccup.Visible := False;
       end
       else begin
         startDetail[i] := True;
       end;

       Inc(i);
    end;
</code></pre>

<p>Thanks so much for your attention.</p>