Silverlight 4:DataForm、currentItem 和 AutoCommit

发布于 2024-09-28 07:25:28 字数 301 浏览 0 评论 0原文

我有一个 DataGrid 和一个 DataForm。我将数据分配给 DataForm,其中数据网格中当前选定的项目单独为 DataForm.CurrentItem。这意味着我在 DataForm 上没有任何“下一个/上一个”按钮,并且用户可以切换到 DataGrid 中的任何行。

我的问题是,尽管我在 DataForm 上设置了属性 AutoCommit="True",但如果用户编辑某些内容并单击 DataGrid 中的另一条记录,它就会崩溃。

当用户离开表单时,如何强制它保存 DataForm?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心病无药医 2024-10-05 07:25:28

我得到了这个工作,但我不确定这是否正确。在数据网格的 SelectionChanged 事件中,我添加了以下内容:

DataForm.CommitEdit();

它停止崩溃并给我错误。如果其他人有更好的解决方案,请告诉我。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文