I think your Ordering of Attaching and Detaching Might become Problamatic Here. In Ideal Situation It should be Detaching First and then attaching the event.Where as You had done it Totally Reverse. Please Check it by Considering this facts by Changing code as below.
grdpurchase.LoadingRow -= new EventHandler<DataGridRowEventArgs>(grdpurchase_LoadingRow);
grdpurchase.LoadingRow += new EventHandler<DataGridRowEventArgs>(grdpurchase_LoadingRow);
grdpurchase.ItemsSource = arr;//ArrayList