Xamarin Vertical align a Label within a Grid Cell
Some people have had trouble vertical aligning text tot he center of a Xamarin Foms Grid Cell, the answer is to add three simple attributes.
Apply the following to the Label in question and it should center vertically within the cell:
Center the Label horizontally:
HorizontalOptions = LayoutOptions.Center
Center the Label vertically:
VerticalOptions = LayoutOptions.FillAndExpand
Center the Label Text vertically:
VerticalTextAlignment = TextAlignment.Center
And that's it, the Label should now vertically align to the center of its parent.
Note: Xamarin has recently replaced YAlign with VerticalTextAlignment, so keep an eye out for that.
Published at 8 Jan 2017, 10:23 AM