I need to merge two column headers that are side-by-side into a single column header. How do I do that? I'd like the columns themselves to remain separate. I just want the header to look like a single header.
Hi,
There's no way to do this via simple property settings.
But there are a couple of ways you can achieve what you want. It's going to depend on what version of the controls you are using, though.
If you have a pretty recent version, then you could set the RowLayoutStyle on your grid to GroupLayout. Then you put the two columns into a group and hide the columns headers so that the group header takes the place of the column headers.
If you have an old version of the controls, then you may not have the option for GroupLayout, so you could use a RowLayout with an unbound column. You use the column.RowLayoutColumnInfo.LabelPosition to hide the column headers for the two real bound columns and hide the cells (LabelOnly) for the unbound column. The unbound column's header will act as the combined header for the two real columns.
A third option, which will work in any version of the grid but is a bit harder to implement it to use a CreationFilter to remove the UIElement for one of the column headers and extend the other into the empty space thus created.
This will be tricky, though, especially if you are not experienced with CreationFilters.
In the 1st method, what is the code to hide the column header under the group.
Hope this column hiding you specified only hides the header under the group and not its cells below it.
Thank you,
If you have a column and you want that column to show cells, but not a header, you do this:
column.RowLayoutColumnInfo.LabelPosition = LabelPosition.None;
This worked. Thank you.