TTMSFMXNativeUICollectionView

Hi,

How can I delete a specific item from the collection?

Regards,

Ken

the collectionview is designed to work with a dynamic number of sections/items. You can specify in the OnGetNumberOfItemsInSection how many items there are, your data needs to be provided by a separate list / collection that you manage in your application. If you delete an item from the list and then call TMSFMXNativeUICollectionView1.ReloadData; the item will be removed. 


You can look at the demo that is included how the items are added to the collectionview.

Kind Regards, 
Pieter

Hi,

I have been working from your example. I've added a button to delete an item (shown below). Deleting an item is fine but deleting a section crashes on the reload.

Any ideas?

Ken

procedure TForm1130.CityTripItemButtonClick(Sender: TObject;
  AControl: TTMSFMXNativeUICollectionViewTemplateControl; ASection,
  ARow: Integer);
var
  Cont:TContinent;
begin
  Cont:=FindContinentByID(ASection);
  Cont.Cities.Delete(ARow);
  if Cont.Cities.Count=0 then
    FContinents.Delete(ASection);
  CityTrip.ReloadData;
end;