从 gridview 对象获取父列表视图

发布于 2024-08-04 20:56:46 字数 109 浏览 3 评论 0原文

在 WPF 应用程序的代码隐藏中,我有一个包含 GridView 的变量。我确信这个 GridView 是 ListView 的视图。有什么方法可以获取 ListView 的引用吗?

谢谢

In the code-behind of a WPF application I have a variable containing a GridView. I know for sure that this GridView is the View of a ListView. Is there any way to get a reference to that ListView?

Thanks

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

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

发布评论

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

评论(1

揽清风入怀 2024-08-11 20:56:46

http://www.hardcodet.net/2008/02/find-wpf- Parent

我们使用这些辅助类来查找可视化树中的可视元素已经有一段时间了。在这种情况下,您只想使用该方法,它会追捕视觉祖先。

TryFindParent<ListView>(yourGridView);

http://www.hardcodet.net/2008/02/find-wpf-parent

We've been using these helper classes for a while to find visual elements in the visual tree. In this case, you'd just want to use the method and it will hunt down the visual ancestor.

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