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.
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.
Looking forward for your reply.
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.