开发者

Silverlight 4: DataForm, currentItem and AutoCommit

开发者 https://www.devze.com 2023-01-20 15:58 出处:网络
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/Prev

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消