DataGrid SelectionChanged 发生得太频繁

发布于 2024-09-05 19:01:34 字数 184 浏览 1 评论 0原文

由于我有一个 DataGrid 作为另一个 DataGrid 的 RowDetailsTemplate,所以我得到了一个 stage effekt。如果我更改内部 DataGrid 中的选择,则外部 Grid 中的 SelectionChanged-Method 也会自动调用。我不知道为什么,但我想知道我能做些什么来应对这种情况。

谢谢

As I have a DataGrid as another DataGrid's RowDetailsTemplate, I've got a strage effekt. If I Change selection in my inner DataGrid, the SelectionChanged-Method in the outer Grid is automatically caled, too. I don't know why, but I would like to know, what I can do against this.

Thx

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

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

发布评论

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

评论(1

怎会甘心 2024-09-12 19:01:34

只是猜测,但这是因为 SelectionChanged 是一个路由事件并且只是通过外部 DataGrid 冒泡吗?如果是这样,请务必在处理之前检查 sender 参数以了解该事件实际属于哪个 DataGrid。

Just a guess, but is it because SelectionChanged is a routed event and is just bubbling up through the outer DataGrid? If so, just be sure to check the sender parameter to see which DataGrid the event actually belongs to, before handling it.

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