WPF DataGrid CellEditEnding - DataSet不更新直到行丢失焦点 [英] WPF DataGrid CellEditEnding - DataSet Not Updating Till Row Lost Focus
问题描述
如何确保每次列编辑完成(CellEditEnding)时,该行的实际上下文会在那一点更新(不只是当行丢失时焦点)
提前感谢
a href =http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.commitedit%28v=VS.100%29.aspx =noreferrer> DataGrid.CommitEdit
从您的 DataGrid.CellEditEnding
处理程序,一定要处理重入。
这是一篇博客文章,描述了这项技术:
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 of it's context item does not occur till focus on that row actually occurs. This becomes a huge issue when there is only one item left, since it may never lose focus.
How do I make sure that each time a column edit is complete (CellEditEnding), the actual context for that row is updated at that point (not just when the row loses focus)
Thanks in advance!
You can use DataGrid.CommitEdit
from your DataGrid.CellEditEnding
handler, being sure to handle reentrancy.
Here's a blog article that describes the technique:
这篇关于WPF DataGrid CellEditEnding - DataSet不更新直到行丢失焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!