Created
July 23, 2019 05:10
-
-
Save JamestsaiTW/a07de6cc6d34f392481f43c6ffcb6c01 to your computer and use it in GitHub Desktop.
Xamarin.Forms for Grid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void PreviewGridCell(Grid grid , Color cellBackgroundColor) | |
{ | |
var columnCount = grid.ColumnDefinitions.Count; | |
var rowCount = grid.RowDefinitions.Count; | |
for (int row = 0; row < rowCount; row++) | |
{ | |
for (int column = 0; column < columnCount; column++) | |
{ | |
var boxView = new BoxView() | |
{ | |
BackgroundColor = cellBackgroundColor | |
}; | |
Grid.SetColumn(boxView, column); | |
Grid.SetRow(boxView, row); | |
grid.Children.Add(boxView); | |
} | |
} | |
var allBuildPreviewCellCount = columnCount * rowCount; | |
for (int start = 0; start < grid.Children.Count- allBuildPreviewCellCount; start++) | |
{ | |
var targetCellView = grid.Children[0]; | |
for (int raiseCount = 0; raiseCount < grid.Children.Count - 1; raiseCount++) | |
{ | |
grid.RaiseChild(targetCellView); | |
} | |
} | |
} | |
======================================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment