Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit an unbound cell in a bound DataGrid?

Tags:

c#

wpf

datagrid

So I have a DataGrid bound to a data source (using ADO.NET), I created a new local column (it doesn't need to exist in database). I do some calculations and then put the results in that column. Now, I know how to edit/access the bound cells via DataSet, but I don't know how to do it for the cells of that new column because it's not in the DataSet. I want to iterate each row and edit the cell value of the new column. Any help is appreciated.

like image 691
Ali Abdelfattah Avatar asked Nov 13 '22 01:11

Ali Abdelfattah


1 Answers

For anyone else who comes to this page, adding the following attribute to my DataGrid's declaration did the trick for me:

SelectedItemBinding="{Binding /}"

For more information, please check this question.

like image 160
dotNET Avatar answered Dec 11 '22 06:12

dotNET