Silverlight 4: DataForm, currentItem and AutoCommi

2019-06-01 09:59发布

I have a DataGrid and a DataForm. I'm assigning data to the DataForm with the currently selected Item in the datagrid individually as DataForm.CurrentItem. This means that I do not have any Next/Previous button on the DataForm and the user can switch to any row in the DataGrid.

My problem is that although I have set the property AutoCommit="True" on the DataForm, if the user edits something and clicks on another record in the DataGrid, it crashes.

How can I force it to save the DataForm when the user moves away from the form?

1条回答
smile是对你的礼貌
2楼-- · 2019-06-01 10:26

I got this working but I'm not sure whether this is correct. On SelectionChanged event of datagrid I added the following:

DataForm.CommitEdit();

and it stopped crashing and giving me the error. If anyone else has a better solution please do let me know.

查看更多
登录 后发表回答