I have created a nested WPF Datagrid. I see you can expand it by clicking on the row, but it doesn’t collapse when you do the same thing.
Few questions:
- How can the user collapse the grid?
- Is there a way to get Expand/Collapse buttons on the parent rows?
- Whenever you click on a different parent to expand, it collapses the previous one you are on. Is there a way to get the grid to stay the way you make it. i.e. If I expand row 1 then go to row 3, row 1 will stay where I expanded it to.
Thanks,
Greg
There are couple approaches to reach such behavior.
For example
Expand/Collapse button in a Silverlight DataGrid.
If you prefer
xamlthen use:And
AttachedBehaviorthat actually will changeDetailsVisibility:And apply this for
RowHeaderStyleofDataGridwhere you want to expand/collapseDetailsTemplate.