In a WPF datagrid is it possible to group column headings?
What I\'m after is
| Column 1 | Column 2 | Column 3|
| a b c | a b c | a b c |
|
This question is a bit old, but it was one of the first google results that came up when I was looking for a solution to this problem, and I don't like either answer posted here. So here's a simple alternative using a custom Header and ClipToBounds=False.
The only thing you need to do is ensure that the combined width of whatever columns this header is spamming is at least the width of the header column.
The TextBlock
that contains the first character of the header text and Canvas.Height
binding is used to block out the height needed for the header. It is only needed if your full datagrid header does not have an element that defines the header height, or if the header spamming multiple columns is bigger than the rest of them (which was my case... this was the only header column with bold text)