Hi,
How would one change the text alignment of header text in the grid view?
Is there a way to do that in the C# version?
Thank you
To set the header text of a column, just create a column definition and set the HeaderText property.
IGGridViewColumnDefinition column = new IGGridViewColumnDefinition ("myField"); column.HeaderText = "Column 1"; dataSourceHelper.ColumnDefinitions.Add (col);
-SteveZ
Yes. That was not the question though. How dow change the text alignment (Left, Right, Center)?
Ah, sorry, read it to fast.
There isn't a property that on a per column level.
We do offer it on the theme, which controls all columns:
public class MyTheme : IGGridViewThemeDefinition { public override UITextAlignment HeaderCellTextAlignment { get { return UITextAlignment.Center; } } }
gridView.Theme = new MyTheme();
Or you can override the dataSource and provide your own HeaderCell. Then you can set the cell's TextLabel's TextAlignment property.
public class MYDSH : IGGridViewDataSourceHelper { public override IGGridViewHeaderCell CreateHeaderCell (IGGridView gridView, int column) { IGGridViewHeaderCell cell = (IGGridViewHeaderCell)gridView.DequeueReusableCell ("MYHEADERCELL"); if (cell == null) { cell = new IGGridViewHeaderCell ("MYHEADERCELL"); cell.TextLabel.TextAlignment = UITextAlignment.Center; } return cell; } }