在哪里可以找到 TreeListViews ColumnHeaderClick 事件?
我正在开发一个工具,它以分层方式显示数据库中的数据。由于每个项目都有附加数据,因此我使用 TreeListView 控件在附加列中显示它们。列数由用户输入确定。
我使用的自定义控件是 Ricciolos TreeListView: http://windowsclient.net /blogs/ricciolocristian/archive/2008/03/22/a-complete-wpf-treelistview-control.aspx
我现在的问题是,我需要捕获 ColumnHeaderClick 事件来应用排序逻辑。我已经面试过谷歌阿姨了,但是没有结果。 也许这里有人知道在哪里可以找到这样的事件以及如何确定哪个列标题已被单击。
谢谢
I'm developing a tool which shows data from a database in a hierarchical manner. As there are additional data for each item I'm using a TreeListView control to display them in additional columns. The number of columns is determined by user input.
The custom control that I'm using is Ricciolos TreeListView:
http://windowsclient.net/blogs/ricciolocristian/archive/2008/03/22/a-complete-wpf-treelistview-control.aspx
My problem now is, that I need to catch the ColumnHeaderClick event to apply a sorting logic. I already interviewed auntie Google, but no results.
Maybe somene here knows where to find such an event and how to determine which column header has been clicked.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为 GridViewColumnHeader.Click 事件添加处理程序。此帖子介绍了如何为 ListView 执行此操作,它使用相同的底层控件。此代码改编自该链接:
或者,您可以通过 XAML 附加处理程序,如下所示:
e.OriginalSource 将包含 GridViewColumnHeader,e.Source/sender 将是 TreeListView。
You would need to add a handler for the GridViewColumnHeader.Click event. This post describes how to do it for the ListView, which uses the same underlying controls. This code was adapted from that link:
Alternatively, you can attach a handler via XAML like so:
The e.OriginalSource will include the GridViewColumnHeader, and e.Source/sender would be the TreeListView.