I just want to vent about how difficult it is to save and restore the layout of a grid when it is in treeview mode.
I have spend more time fighting with this grid control than I have writing the code of my application (well, it seems like it anyway).
I have tried several methods, such as writing the grid xml to isolated storage, and then reading it back; looping through the rows and saving the state of the nodes, etc. Each time there is some "gotcha" that totally screws up the node's collapsed/expanded plus/minus state, or something else that goes wrong.
I have a grid that sometimes has two levels, and sometimes three, based on a user's access rights. At the bottom of my screen I have a "filter" pane, where the user can filter the grid based on column values. When they click to apply a filter, I try to save the state of the grid. Then I apply the filter, showing and hiding rows based on their filter criteria. When they are done with the filter, they click a "remove filter" button, and I then attempt to refresh the grid to the previous state.
Sounds easy enough, and it works great as long as they filter on a row that is a node. If the filter on a normal, "detail" row, the grid goes all to heck when I try to restore it.
Why doesn't this grid have "save state" and "restore state" methods built in? The lame "Tree.Show" method only shows or hides every node in the tree. Not too helpful, if you ask me.
Maybe I am dense, but I get frustrated fighting with user interface controls that are supposed to save us time, but in the end take more time to make them actually do anything just a little bit out of the ordinary.
OK, I am finished venting.