当 DataGrid 处于编辑模式时,有没有办法阻止用户选择另一行?
我希望,如果一个单元格/行进入编辑模式,那么,如果用户尝试选择不同的行,它应该尝试提交该行,如果该行未成功提交,它应该拒绝选择请求,并且编辑行应保持选中状态并处于编辑模式。
你有过找好帮手的经历吗?有什么好的解决方法吗?
注意:我已经在这个问题上挣扎了很长时间并且已经获得了一些经验,所以请仅发布工作示例,而不是随意的想法。
I want, that if a cell/row goes to edit mode, then, if the user attempts to select a different row, it should try to commit that row, if the row is not committed sucessfully, it should decline the selection request and the editing row should remain selected and in edit mode.
Do you have experience with a good helper for it? any good workaround?
NOTE: I've been struggling with this issue for a long time and already got some experience, so please post only working examples, not random thoughts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面的代码包含来自此处的扩展 (代码标准化为适合 StackOverflow 屏幕,抱歉)。
用法:
代码隐藏(pseudu):
注意:Visual Studio 可能不会在智能感知中显示事件,甚至可能生成设计时错误,但它应该编译并正常工作。
仅供参考:代码格式已修改以适应SO屏幕。
The code bellow is includes extension from here (code normalized to fit StackOverflow screen witdh, sorry).
Usage:
Code behind (pseudu):
Note: visual studio might not show the event in the intellisense and might even generate a design-time error, but it should compile and work perfect.
FYI: code formatted modified to fit SO screen.