Can anybody tell what is the best method to edit a grid using datatemplate column?

Nov 17 2012 2:18 AM
I'm using wpf datagrid for editing sales entries like quantity, discount, etc. I'm using DataTemplateColumn for each editable columns and textbox control inside each column. Each textbox is bound to a different column of the DataTable. While editing quantity, I have to calculate the net amount and update that column, which is done by updating the datatable bound to the grid. Handling everything insidetextchanged, lostfocus, gotfocus, etc of each editable textbox. The datagrid selection unit is set to "Cell".
Now lots of issues are occurring while using this method. Sometimes the textchanged event of textbox inside templatecolumn is firing multiple times which makes all calculations wrong.
Can anybody tell what is the best method to edit a grid using datatemplate column? I have to use textbox itself because we have a number pad control which supports only textboxes. Why are the textchangedevents firing multiple times? This happens even when we scroll the grid vertically.