Is there an easy way to make column cell values be vertically aligned to the top? Basically, I have one column where the values wrap, so a row could end up being very tall...off the screen tall. That means the other values on that row would be in the middle vertically, so the user has to scroll way down to see them. I would like to set all my columns to vertically align values to the top, but don't see that on IGGridViewColumnDefinition, just "textAlignment", which is horizontal alignment. Thanks!
Hi Michael,
In iOS a UILabel doesn't have a vertical textAlignment property. It always align text in the middle of the UILabel. The way you control positioning on the vertical axis, is by positioning the label and having it fit to the container.
You should be able to do this still with minimal code changes though. You would basically just create a custom cell:
public partial class CustomCell : IGGridViewCell { public override void SetupSize (SizeF size) { base.SetupSize (size); this.TextLabel.SizeToFit (); } }
Then all you need to do is tell the grid to use your cell by default:
grid.RegisterClassForCellReuse (new MonoTouch.ObjCRuntime.Class ("CustomCell"), "Cell");
Hope this helps,
-SteveZ
Steve,
This seemed to work, but if you flick around to scroll up/down fast, some cell text actually start to disappear (seemingly random), so I had to revert the SizeToFit for now. Any idea what could be going on with that? Thanks!