Hi, I need to create RadDataGrid in xamarin forms programmatically. it only creates the header and it's fine. But when I insert new data in ItemSource there has no new row added in UI while ItemSource already updated with new row data. I have tried in several ways and still, there has no progress. Have any other options to add a data row in RadDataGrid? code snippets are attached.
private readonly RadDataGrid dataGrid = new RadDataGrid() { IsEnabled = true, AutoGenerateColumns = false };
private List<GridModel> dataSource = new List<GridModel>();
public async Task DoSetup()
{
Grid outermost = this.GetOutermostGrid();
this.Content = outermost;
AddHeaderRow(columsList);
dataGrid.ItemsSource = dataSource;
outermost.Children.Add(dataGrid);
Grid.SetColumn(dataGrid, 0);
}
private void AddHeaderRow(IEnumerable<string> headers)
{
foreach (string s in headers)
{
this.dataGrid.Columns.Add(new DataGridTextColumn() { HeaderText = s, SizeMode = DataGridColumnSizeMode.Stretch, Name = s, PropertyName = s });
}
}
private void AddNewRow(GridModel model)
{
//dataSource.Add(model);
//dataGrid.ItemsSource = dataSource;
(dataGrid.ItemsSource as List<GridModel>).Add(model);
}