Collectionview change layout at runtime


I want the users to give the ability to configure the collectionview in the way that they are able to change properties of the template controls within the item at runtime:

  // Template-Properties settings at runtime
  TMSFMXNativeUICollectionViewTemplateLabel1.Width  := FLabelWidth;
  TMSFMXNativeUICollectionViewTemplateLabel1.Height := FLabelWidth;
  TMSFMXNativeUICollectionViewTemplateLabel1.X      := FLabelX;
  TMSFMXNativeUICollectionViewTemplateLabel1.Y      := FLabelY;

Where do I set these properties?

The problem is that some template controls have the new properties and some don't (due to the reuse of the template controls?).

I Don't want the users to restart the app to see the changes in the controls.

Thanks in advance,


You can use the OnApplyFooterValue / OnApplyHeaderValue / OnApplyItemValue event
I know, but this would mean, it will be triggerd thousand of times when scrolling.

The settings apply to all items, not different settings for each item.

You can also change these settings from a button click and then call ReloadData. The new settings should be applied to the items.

Thats what I tried.

They are all messed up. The cached controls still show their old dimensions.

Maybe you can try by wrapping the code with BeginUpdate / EndUpdate?