I have a multi level hierarchical UltraGrid (think indentured parts list). The number of levels is determined at runtime depending on how deep the drawing tree is. The issue I'm having is if I apply a saved layout to the grid the very last child grid does not get the layout (in this case column order) apply to it. It's parent band does have the correct order.
I'm using DisplayLayout.LoadFromXml(_layoutpath, PropertyCategories.All) to apply the layout
Any clues would be helpful.
Thank you for posting. I have created a sample of UltraGrid with hieratical data , in the sample, I am saving/loading the layouts using SaveAsXml/ LoadFromXml respectively.
Now when I run the sample all the childs grid does load the layout as expected although i am not sure if my sample is the exact same scenario of yours as you determined the number of levels at run time .
The best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally, that you can be done by either modifying my sample or can send a sample of your own.
I have also attached the sample I was using for my testing
Looking forward to hear you back.
Sincerely,Divya JainAssociate Software Developer
I think I see what's happening. If I save a layout where the underlying data is 4 bands deep, then apply that layout to a new set of data that is 5 bands deep, the layout does not continue to the 5th band.
What I really want is for all subsequent child bands to have the same layout as the initial band(0). How could I do this?
Nothing in the loading or saving of layouts functionality can copy the settings from one band to another. So your best bet here would be to simply load your layout and then loop through the bands and make each child band's column order match the parent band.
This is a bit tricky, because you can't just set the VisiblePosition on each column. You have to do it in order from the the column you want first, second, third, etc. If you do it in an arbitrary order, then setting a later column can cause one of the columns you already positioned to shift.
To solve that problem, I wrote a little class that helps you do this more easily.
I am attaching a sample here with two buttons. The first button just randomly re-arranges the band 0 column order. You don't really need that one for your case, it's just for the sample.
The second button uses the WinGridColumnPositioner class to make every child band match the parent band in terms of the order of the columns.
That's what I was looking for.