[MainPage.Xaml.cs]
private void Grid_GridLoaded(object sender, GridLoadedEventArgs e)
{
//You can get the generated column inside this event
//var columnsCount = this.Grid.Columns.Count();
} |
|
We are able to reproduce the issue “When HeaderText property value is set from GridLoaded event value is not updated” in above Xamarin forms version 4.1. Here we noticed Runtime changes for bindable property does not work in Forms version 4.2 and above, hence issue is due to Xamarin forms FrameWork break. Already we have logged the bug report to Xamarin team. For further reference we have added the frame work bug link here.
Frame work bug link:
https://github.com/xamarin/Xamarin.Forms/issues/8860
[C#]
---
Grid.AutoGeneratingColumn += Grid_AutoGeneratingColumn;
private void Grid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e)
{
if (e.Column.MappingName == "OrderID")
{
e.Column.HeaderText = "ID";
}
else if (e.Column.MappingName == "CustomerID")
{
e.Column.HeaderText = "Customer ID";
}
else if(e.Column.MappingName == "CustomerName")
{
e.Column.HeaderText = "Name";
}
else if (e.Column.MappingName == "ShipCountry")
{
e.Column.HeaderText = "Country";
}
else if (e.Column.MappingName == "ShipCity")
{
e.Column.HeaderText = "City";
}
}
--- |