While browsing the forums recently, I ran across a post asking how to make a "Stacked Header Row" for a GridView. This was a really good question that I had not considered before. So I pondered a bit and decided on a solution. Now there are two ways I can think of to do this. One is to write a new GridViewHeaderRowPresenter. However, that seemed like a bit much work. The second way is to use databinding and some converters. That was what I settled on.

 The code is not perfect but I think it is a good example. When resizing the top header the assumption is made that you want the subheaders to share the space equally. That should be changed. Also, I could see a desired behavior when resizing the first element in the second row should be to just resize the columns within the larger columns current width. Instead, the behavior I coded was to grow the column.

The code does have some comments but if they are not enough, leave a comment and I will try to add more details.

This code sample is provided under the Microsoft Permissive License