After updating the nuget (18) packages, I compiled my project and gave this error:
Initializing the object can be simplified
It points to these files in my code.
GridTextColumn dataLib = new GridTextColumn();
Here is the complete class
public class Control
{
SfDataGrid dataGrid = new SfDataGrid();
DataService dataService = new DataService();
public async void CriaDataGrid()
{
dataGrid.AutoGenerateColumns = false;
GridTextColumn dataLib = new GridTextColumn();
dataLib.MappingName = "DataLib";
dataLib.HeaderText = "Data";
dataLib.Width = 80;
dataLib.TextAlignment = TextAlignment.Start;
dataLib.CellTextSize = 9;
GridTextColumn cliente = new GridTextColumn();
cliente.MappingName = "Cliente";
cliente.HeaderText = "Cliente";
cliente.Width = 180;
cliente.TextAlignment = TextAlignment.Start;
cliente.CellTextSize = 9;
GridTextColumn vendedor = new GridTextColumn();
vendedor.MappingName = "Vendedor";
vendedor.HeaderText = "Vendedor";
vendedor.Width = 180;
vendedor.TextAlignment = TextAlignment.Start;
vendedor.CellTextSize = 9;
GridTextColumn filial = new GridTextColumn();
filial.MappingName = "Filial";
filial.HeaderText = "Filial";
filial.Width = 100;
filial.TextAlignment = TextAlignment.Start;
filial.CellTextSize = 9;
dataGrid.Columns.Add(dataLib);
dataGrid.Columns.Add(cliente);
dataGrid.Columns.Add(vendedor);
dataGrid.Columns.Add(filial);
//dataGrid.AllowResizingColumn = true;
dataGrid.ItemsSource = await dataService.GetLiberaAsync();
dataGrid.SelectionMode = SelectionMode.Single;
dataGrid.SelectionChanged += DataGrid_SelectionChanged;
}
void DataGrid_SelectionChanged(object sender, GridSelectionChangedEventArgs e)
{
//DisplayAlert("Alert", "You have been alerted", "OK");
}
}
EDIT1