0
A
回答
0
见讨论here,而这个解决方案:
private void OnRowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
{
DataGrid dataGrid = sender as DataGrid;
if (e.EditAction == DataGridEditAction.Commit) {
ListCollectionView view = CollectionViewSource.GetDefaultView(dataGrid.ItemsSource) as ListCollectionView;
if (view.IsAddingNew || view.IsEditingItem) {
this.Dispatcher.BeginInvoke(new DispatcherOperationCallback(param =>
{
// This callback will be called after the CollectionView
// has pushed the changes back to the DataGrid.ItemSource.
// Write code here to save the data to the database.
return null;
}), DispatcherPriority.Background, new object[] { null });
}
}
}
相关问题
- 1. WPF DataGrid CellEditEnded事件
- 2. WPF中DataGrid的CellValueChanged事件?
- 3. 在wpf DataGrid中使用MouseUp事件
- 4. WPF DataGrid验证错误未被捕获
- 5. DataGrid上的OnScrollShow事件WPF
- 6. wpf datagrid点击事件
- 7. Datagrid行选择事件,WPF
- 8. 在DataGrid中捕获DoubleClick
- 9. WPF子类捕获按键事件
- 10. WPF捕获文本框onBlur事件
- 11. WPF Datagrid:取消排序事件(WPF Bug?)
- 12. 在ngTable中捕获事件
- 13. 在WPF中的应用程序级别捕获关键事件
- 14. 在WPF列表框项目模板中捕获事件
- 15. 在wpf应用程序中捕获Windows关机事件
- 16. 捕获在WPF中的OnExit事件与MVVMCross
- 17. WPF - 从不在顶端的控件捕获事件
- 18. SVG中的事件捕获
- 19. 获取在WPF的DataGrid
- 20. WPF Datagrid DataTemplate ComboBo不捕获ViewModel中的变化
- 21. 从MVVM中的DataGrid捕获标签文本WPF
- 22. WPF-MVVM:从DataGrid风格的Handeling事件
- 23. PreviewMouseRightButtonDown路由事件和WPF DataGrid
- 24. WPF Datagrid行编辑“已结束”事件
- 25. 鼓起来WPF Datagrid项目事件
- 26. WPF DataGrid不拾取CollectionChanged事件?
- 27. WPF的DataGrid不挂钩事件
- 28. Wpf工具包datagrid DataGridCheckBoxColumn on_click事件:
- 29. WPF Datagrid OnPropertyChanged导致SelectionChanged事件
- 30. WPF的DataGrid SelectedCellsChanged事件触发两次