I tried to <Virtualize>
a list of a thousand items showing several per row, with display: inline-block
. The result in Blazor kinda works, but seems to always leave the last row with the same number of item in it, no matter how many are in the total list. I realized that this makes sense in that Virtualize doesn't know anything about breaking up the items into chunks; it can begin the rendering at any item. Thus, when I view the bottom of the list and dynamically add an item to the list, the list re-renders, re-flowing all the items shown, removing the previous beginning item and again putting the last item (the new one) at the bottom in a row with the same number of items in that row as before. I'd like it to be able to add it after of the last item without reflowing all the items before it.
Demo: Scroll all the way to the bottom, wait for images to load, and click Add. Sometimes it initially adds it properly without reflowing all previous items, but if you keep adding, soon enough it will reflow all items unnecessarily and leave you with a final row with a unchanging number of items in it. Here is the code, focusing on ProductGrid.razor.
Any ideas on how to coax the Virtualize component into allowing multiple items per row with consistent layout as things change? Perhaps we need to make it aware of a "chunk size", though it would be different based on different screens/styles?