0
After having made some updates to the nuget(18) packages, I went to compile my project and this error occurs:
Object initialization can be simplified
It points to those files in my code.
GridTextColumn dataLib = new GridTextColumn();
Here 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
This is a build error or a Warning?
– Jéf Bueno