Thank you for fixing the template selector but that was not my problem.
The problem is adding columns and setting their binding to an indexed value. I want to be able add rows through the AddDynamicRows method in the MainView.xaml.cs but I can not get it to data bind to the column.
------------------------
------------------------
var col = new GridTemplateColumn();
col.HeaderText = code;
col.MappingName = mappingName;
col.Width = 100;
var cellTemplate = new DataTemplate(() =>
{
var label = new Label();
label.HorizontalOptions = LayoutOptions.Center;
label.VerticalOptions = LayoutOptions.Center;
label.SetBinding(Label.TextProperty, new Binding(mappingName, converter: new ValueConverter(),converterParameter: null));
return label;
});
col.CellTemplate = cellTemplate;
MyDataGrid.Columns.Add(col); |