Hello,
I tried to display hierarchical data in the xamgrid - all levels with the same type / columns - and I want to share the "outer headers" (and header-sizes) for all indentation levels.
However - this seems to be impossible with the xamGrid, but I found a kinda hacky way how to achieve this with XamDataGrid (WPF):
https://ko.infragistics.com/community/blogs/b/josh_smith/posts/synchronizing-field-widths-between-fieldlayouts-in-xamdatagrid
Questions:
- Is this hack still necessary
- Is this hack even possible in Silverlight XamGrid (which does not have the needed events / fields)
- Is this hack possible while still having an indentation != 0 pixel (I don't like that hierarchy-levels aren't indented!)
Thanks for your help
Sven Schmid
Hello Sven,
That implementation for the XamDataGrid is still necessary. Whether it can be ported over to the XamGrid though, I'm not sure. I am looking into whether it can still be used and if there is a different approach we can take for the XamGrid. I will get back to you early next week.
I was able to implement your requirement using a somewhat similar approach to the blog post, with some minor changes. I didn't handle the SizeChanged event and the blog only dealt with a master -> detail scenario. The sample I'm providing should deal with any depth in a hierarchy.
Essentially I bound each child column to it's parent column so when the parent column's width changes so does the child's. When you hide all the child columns leaving the root-level column headers, the bindings will cascade down to the bottom levels. One thing to note though is that due to the way scrolling works in the XamGrid, horizontal scrolling may produce some misalignment. This is because the rows of the children don't have the same width as the parent rows due to indentation. This difference in width causes the rows to scroll at different rates. The only way to fix this is to set the Indentation to 0 so all rows are the same width.
Let me know if you have any questions on this.
Hi Rob, can this approach (child column binding to the parent column) be used for a WPF solution as well? Thanks.
Hi C,
Sorry for the late reply. If you use the WPF version of the XamGrid then the answer should be yes. I don't see anything in that code that is SL specific.