In ShowColumnMajor, the previousCellHeight calculation uses itemDimensionsWithSpacing[rowIndex - 1].Y. This is incorrect because itemDimensionsWithSpacing is indexed by the global item index, not the local rowIndex for the current column. This results in misaligned cells and an incorrect grid layout. The correct value is in gridLayout.RowHeights[rowIndex - 1].