Creating a simple order entry system. Want to auto-calculate totals in row as data is entered.
Data source is a simple ObservableCollection of OrderLineItem defined as follows:
public class OrderLineItem
{
public string OrderID { get; set; }
public object CustomerID { get; set; }
public string CustomerName { get; set; }
public string Description { get; set; }
public string VendorPart { get; set; }
public double Quantity { get; set; }
public double UnitCost { get; set; }
public double UnitResale { get; set; }
public double TotalCost { get; set; }
public double TotalResale { get; set; }
public Boolean Combine { get; set; }
public Boolean Reimburse { get; set; }
}
Code looks like this so far:
private void dataGridLineItems_CurrentCellEndEdit(object sender, Syncfusion.SfDataGrid.XForms.GridCurrentCellEndEditEventArgs e)
{
switch (e.RowColumnIndex.ColumnIndex)
{
case 4:
OrderLineItem record = (OrderLineItem)dataGridLineItems.GetRecordAtRowIndex(e.RowColumnIndex.RowIndex);
//Unit Cost
Double Quantity = 0.0;
try { Quantity = record.Quantity; } catch { }
Double UnitCost = 0.0;
try { UnitCost = record.UnitCost; } catch { }
Double TotalCost = Quantity * UnitCost;
record.TotalCost = TotalCost;
break;
case 5:
//Unit Retail
break;
case 6:
//Unit Quantity
break;
}
}
New value of TotalCost is not shown in the grid. Do I need to do something to notify the grid that the value has changed?