I am doing an application that consists in a DataGrid filled only with numbers, every time that you touch a cell the value of the cell will increase one at once, when I touch the cell the application crash.
I was doing the same in Xamarin.Forms, but the application not crashed.
This is the event Tapped
private void GrdCountConcept_GridTapped(object sender, GridTappedEventArgs e)
{
grdCountConcept.EndEdit();
int rowIndex = e.RowColumnIndex.RowIndex;
int columnIndex = e.RowColumnIndex.ColumnIndex;
List<OrderInfo> source = (grdCountConcept.ItemsSource as List<OrderInfo>).ToList();
if (columnIndex == 0)
{
grdCountConcept.ItemsSource = source;
}
else
{
var recordData = grdCountConcept.GetRecordAtRowIndex(rowIndex);
string columnName = grdCountConcept.Columns[columnIndex].MappingName;
int cellValue = Convert.ToInt16(grdCountConcept.GetCellValue(recordData, columnName));
cellValue++;
switch (columnIndex)
{
case 1:
source[rowIndex - 1].Talla4 = cellValue;
break;
case 2:
source[rowIndex - 1].Talla6 = cellValue;
break;
case 3:
source[rowIndex - 1].Talla8 = cellValue;
break;
case 4:
source[rowIndex - 1].Talla10 = cellValue;
default:
break;
}
grdCountConcept.ItemsSource = source;
}
}
Where OrderInfo only has int values