column header are not visible in XamDataGrid when record count=0 and AutoGenerateFields is True. I want to display the column header in this case. Is it possible?
Hi,
Definitely, it's possible.In your case when the Data Source is empty and AutoGenerateFields ="True" your Data Source should be BindingList(T) type. Because if it's not, the bound control can not get property descriptors of the underlying list object. In the xamDataGridColumnHeaderNonVisible sample application I have used a BindingList<T> collection as my Data Source.Although my Data Source is empty and the AutoGenerateFields property is set to "True", the column headers are visible.
Best Regards,Yanko
I think Mark's struggling with something different. He has more than one field layout wihch addresses multiple object types in the data source, but he wants to predefine the actual column header labels. The grid seems to only support implicit header creation - either through the field first field layout used, or through AutoGenerateFields.
Yes, tbeaulieu is correct.
I have multiple field layouts in one grid, some of which have fields that span columns (and thus don't show all the fields), but I need a common header for the entire grid. I was hoping for some way to specify headers (labels) at the grid level, than add records with different field layouts.
I can accomplish this by using 2 grids -one for the header, and the other for the fieldlayouts (all with hidden headers). But this is obviously a hack. I'll have to control the sorts and column resizes from the 'header' grid to the grid that contains the field layouts. I also had to overlay the 2nd grid to cover up the first row of the 'header' grid.
Any suggestions appreciated. I'm just trying to satisfy the requirements here as cleanly as possible.
Thanks.
Hi marksingleton,
Did you receive a response to your question? I have a similar, though, much less complex scenario. I have a grid containing only one field layout that is dynamically generated in the code-behind (ie: AutoGenerateFields = false). My column headers also do not display if my record count is zero.
Thanks!
Stephen
marksingleton said: Yes, tbeaulieu is correct. I have multiple field layouts in one grid, some of which have fields that span columns (and thus don't show all the fields), but I need a common header for the entire grid. I was hoping for some way to specify headers (labels) at the grid level, than add records with different field layouts. I can accomplish this by using 2 grids -one for the header, and the other for the fieldlayouts (all with hidden headers). But this is obviously a hack. I'll have to control the sorts and column resizes from the 'header' grid to the grid that contains the field layouts. I also had to overlay the 2nd grid to cover up the first row of the 'header' grid. Any suggestions appreciated. I'm just trying to satisfy the requirements here as cleanly as possible. Thanks.
Hello, I resolved my issue in a different way, but the example project that Yanko posted above in this thread does work. It uses the BindingList<T>...
Thanks for getting back to me so quickly. :-)
I actually discovered the reason why my column headers were not being displayed despite my grid configuration. It was because I was setting the Datasource to NULL instead of an instantiated empty list. Once I figured that out, everything was fine.