WPF DataGrid CellEditEnding - DataSet Not Updating Till Row Lost Focus

后端 未结 5 902
粉色の甜心
粉色の甜心 2020-12-16 14:59

I need to be able to update values of a dataset once a cell loses focus from editing. I know when the cell loses focus (CellEditEnding), but problem is, the actual updating

5条回答
  •  时光说笑
    2020-12-16 15:26

    I met a similar problem, I have a DataGrid row that contains 5 columns. The data from the 5 columns will be updated in source only after the entire datagrid row has lost focus.

    After some search, I found an easy way to do it. That is to add "UpdateSourceTrigger=LostFocus" in your databinding in the cell.

    For example:

    
        
            
        
    
    

    This will do the trick, so when each of the cell lost focus, instead of the entire row, the data from the cell will update the source immediately.

提交回复
热议问题