There is an alternative way.
I have posted an example of a DataList using RepeatLayout="flow" plus the corresponding CSS to make the DataList generate its output into a flex box.
Please see https://stackoverflow.com/a/79650596/24374126
Or see the example. Resize your browser to see the effect.
Hope this helps