Hi,
I have bound XamDataGrid to a hierarchical data source and only want one column header for the root records, all expanded child table's column header is hidden, how can I achieve this? Thanks.
Did you ever find a solution to this? We have the exact same problem.
The solution we eventually reached was instead of using the child table capability in our scenario, we manually insert/remove records in the underlying data source to mimic expand/collapse behavior.
I would also like to a solution for this problem, please help.
I have child tables using the same field layout as the root table but only want a single column header at the top. Having column headers in child tables too wastes too much space on the screen.
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I created two FieldLayouts and assigned them to each Item in the XamDataGrid’s AssigningFieldLayoutToItem event handler. I created a global Style for the LabelPresneter which is applied to all the Labels instead for the one you want to show. For it I set the Labelpresenter style directly to the Field’s LabelPresneterStyle property. Please let me know if you have further questions on this matter.
Looking forward for your reply.
Thanks, but this solution creates a problem: Both field layouts are no longer in sync. If I resize the root columns, the child columns also need to resize, change their position etc. This is why I need to have a single field layout and not two seperate ones.
Here you can see how to synchronize the FieldLayouts:
http://es.infragistics.com/community/forums/p/62567/316956.aspx
http://es.infragistics.com/community/forums/p/53090/276218.aspx
Hope this helps you
It says "synchronization is not a built – in functionality" - so you want me to pile further workarounds on top? Nope, thanks. I want something that works relibably and doesn't require constant attention, bugfixing and more workarounds. Especially for such a simple feature...
Hello Stefan,
Sorry for late reply but I had to work on some other project for a while.
I tried the solution you provided but it still has some proble. Now, it generates all the data as expected but it shifts column layout for child records.
I tried to change MainWindow_PropertyChanged method to make it work with no luck. Is there any workaround for this.
Inserted image of the screenshot for your reference.
Thanks,
Priya
.
Or the simpler version of this feature: http://ideas.infragistics.com/forums/192363-wpf/suggestions/5589141-xamdatagrid-hide-child-table-field-headers
Hello Priya,
I can say that the approach used in this sample is meant to work with AutoGenerateFields set to true. If you want to hide some of the Fields you can handle the XamDataGrid's FieldLayoutsInitialized method and hide the Fields you don't want to visualize. I modified the sample to show you this approach. Also I can suggest you vote for this idea, so this functionality can be implemented in our future versions:
http://ideas.infragistics.com/forums/192363-wpf/suggestions/5988260-new-wpf-tree-grid-control
Please let me know if this helps you or you have further questions on this matter.
Thank you for your reply.
I tried your solution in TreeView_SelfReference.zip folder. It generates tree view as required but it does not align second column of XamDataGrid for both parent-child columns when loaded for first time.
If you change the column alignment manually to align then it works perfect afterwards.
What should I change to have even alignment on loading. Your solution is working just fine in that case as well.
In the sample I attached to my last response ("TreeView_SelfReference_Modified.zip") the AutoGenerateFields Proeprty is set to false and there are no child labels. Please note that there are two Styles defined for the LabelPresenter and DataRecordPresenter and their Loaded events are handled. In the handlers the columns are synced and the child headers are hidden. Please let me know if you have further questions on this matter.