More a work task than a bug due to the ongoing development of CollectionView (but we'll just categorize it as a bug for now), it should update its layout when switching the ItemsLayout types from a ListItemsLayout to GridItemsLayout. A good example of where this would be used is in a UI where the user is allowed to toggle between those layouts, such as in a retail app.
This is supposedly semi-functional on iOS but wasn't personally tried. Android doesn't update the layout.
The CollectionView updates its layout to the new type.
The CollectionView does not update its layout until leaving and reentering the page (such as with tabs).
Another possible usage is to switch the number of columns when the device is rotated.. Much needed.
//Not updating at runtime on Android
public void SetColumns(int columns = 2)
{
var grid = ItemsLayout as GridItemsLayout;
if (grid!=null)
{
if (grid.Span == columns)
return; //avoid unneeded
}
ItemsLayout = new GridItemsLayout(columns, ItemsLayoutOrientation.Vertical);
}
Is it not possible to have this for UWP also?
Most helpful comment
Another possible usage is to switch the number of columns when the device is rotated.. Much needed.
//Not updating at runtime on Android public void SetColumns(int columns = 2) { var grid = ItemsLayout as GridItemsLayout; if (grid!=null) { if (grid.Span == columns) return; //avoid unneeded } ItemsLayout = new GridItemsLayout(columns, ItemsLayoutOrientation.Vertical); }