Silverlight 4: DataForm, currentItem and AutoCommit

感情迁移 提交于 2019-12-23 02:33:15

问题


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:


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.



来源:https://stackoverflow.com/questions/3969588/silverlight-4-dataform-currentitem-and-autocommit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!