TreeView in GridView

心不动则不痛 提交于 2020-01-06 14:50:48

问题


I know there must be a way to do this, and perhaps someone has already done it. I googled like crazy but found nothing at all. Anyway, what I want to do is have a TreeView in the first column of a GridView using WPF, which can expand and collapse and that will show/hide the row it belongs to, pretty much something like this (the demo is for ASP.NET, I want to be able to do the same in WPF):

DevExpress demo

In our company we bought Infragistics controls, but it doesn't have a built in solution, we're trying to avoid spending a lot of time coding this solution.

Thank you!


回答1:


Perhaps you're not using the right search terms... IMO, what you're actually looking for is not a GridView with a TreeView inside it, but rather a TreeView with columns.

Here are a some samples of TreeViews with columns (often called TreeList or TreeListView) :

  • http://www.codeproject.com/KB/WPF/wpf_treelistview_control.aspx
  • http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx



回答2:


Infragistics support similar scenario, see their overview - for WinTree control.

They can also do this for grids (see under Hierarchical display).



来源:https://stackoverflow.com/questions/973054/treeview-in-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!