I am new to this control, so I must be doing something wrong. I need to specify my columns manually, and to add/remove columns when the device orientation changes. I have been able to do this in my Xamarin.iOS project (although I encountered exceptions initially on second run of my method, which I was able to fix), but I encounter a NullReferenceException when I attempt to do this in my Xamarin.Android app. Unfortunately there's no stack trace, so I don't even know here to start. Again, this same code works in my Xamarin.iOS app.
To accomplish this, I am getting a reference to the data grid OnCreateView in my fragment, then using it OnStart and OnResume in my method that specifies which columns to display. This causes a NullReferenceException with no stack trace, so I don't know where to begin to troubleshoot. If I comment out this customization method, the data grid renders without exceptions, but it's showing all columns, which I don't want.
My method looks something like this:
var columns = new Columns();
DataGrid.AutoGenerateColumns = false;
GridTextColumn keyColumn = new GridTextColumn();
keyColumn.MappingName = "Id";
keyColumn.HeaderText = "ID";
columns.Add(keyColumn);
DataGrid.Columns = columns;
How do I accomplish this? Is there a sample I can review to figure it out for myself? It may be worth noting that my grid is in a Fragment in a ViewPager, and that I'm using MvvmCross 5.7