“DataContextChanging”事件?
我对 WPF 很陌生,所以如果问题没有意义,请原谅我。数据上下文更改之前是否会触发一个事件?我想在数据上下文切换之前提交挂起的数据更改。
I am very new to WPF so forgive me if the question doesn't make sense. Is there an event that is fired before data context change? I want to commit the pending data changes before the data context is switched away.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有
DataContextChanging
事件,但DataContextChanged
事件提供DataContext
的旧值:There is no
DataContextChanging
event, but theDataContextChanged
event provides the old value of theDataContext
:没有这样的事件,如果您想确保保存数据或者用户可以选择中止编辑,您应该查看 导航 架构,其中屏幕以托管方式更改。
There is no such event, if you want to make sure data is saved or that the user can choose to abort edits you should look into navigational architectures where screens are changed in a managed way.