I am using couple of DataGridTemplateColumn
s in my XAML DataGrid
, each one of which is group of text boxes, since I wanted a grouped header layout for the columns (e.g. merged columns as headers in excel).
All of this works fine, since I am using the HeaderStyle
property of the column to load a StaticResource
for Style
that defines a Grid
layout and implements the grouped headers.
The issue is, the Header
property of the DataGridTemplateColumn
needs to be bound to a model member (or a StaticResource ?), since that will contain a string value that will be used in a ContentPresenter
, which is part of the HeaderStyle
. The ContentPresenter
in the Style
resource is defined as follows:
<ContentPresenter Grid.Row="2" Content="{TemplateBinding Content}"
VerticalAlignment="Center" HorizontalAlignment="Center"
Grid.ColumnSpan="11">
But this doesn't work. It only works if Header="SomeString
, but as soon as I change it to
Header="{Binding Something}"
or Header="{StaticResource SomeResource}"
it just shows a blank header.
Am I missing something here ?