WPF DataGrid source updating on cell changed

后端 未结 4 1758
走了就别回头了
走了就别回头了 2020-12-28 15:24

I am new to the WPF ,and i use it to build a point of sale system.

I have a DataGrid control in the main window bound to an ObservableCollection

4条回答
  •  温柔的废话
    2020-12-28 15:40

    Almund is right. UpdateSourceTrigger=LostFocus will work best in you case. And as you have mentioned that your source is updating when you move to next row, that means I guess, you are using ObservableCollection to bind your DataGrid's ItemSource. Because that is what which you need to achieve what you want.

    
    
    

    You need to add "UpdateSourceTrigger=LostFocus" to each of your columns.

提交回复
热议问题