this the datagrid i got
+==========+==========+==========+==========+
| Product | Price | quantity | Total |
+==========+==========+==========+==========+
so i got Product and Price from MySQL database (Table1). and user enter number in the quantity cell and the program calculat the Total (Total=Price*quantity) the save it in Table2 (in MySQL).
this is an example
+==========+==========+==========+==========+
| Product | Price | quantity | Total |
+==========+==========+==========+==========+
| AAAAA | 30 | 2 | 60 |
+==========+==========+==========+==========+
UPDATE
I add CellEditEndding handler like this
private void Produit_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
DataTable dt = new DataTable();
dt = ((DataView)Produit.ItemsSource).ToTable();
foreach (DataRow row in dt.Rows)
{
row["total"] = (Convert.ToDouble(row["price"]) * Convert.ToDouble(row["quantity"]));
}
Produit.ItemsSource = dt.DefaultView;
}
when i edit a quantity cell every thing is return to 0.
NOTE: when I'm filling the DataGrid i Fill quantity an total with zoros