Reputation: 586
I made in my DataGrid a TemplateColumn with this structure:
<DataGridTemplateColumn Header="Squadra" Width="SizeToCells" IsReadOnly="True" HeaderStringFormat="Squadra">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image MaxHeight="20" MaxWidth="20" Source="{Binding Path= 'crestUrl' , Converter={StaticResource NameToImageConverter}}" />
<TextBlock Text="{Binding name}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
But the Header "Squadra" insn't visible when I start my solution, also if I populate the DataGrid through code the Header became visible. Is this a bug of WPF or I do something wrong?
Upvotes: 0
Views: 40
Reputation: 212
I think it 's because your column is visible but with a width
of 0
(SizeToCells
and no content).
Set a MinWidth="150"
Upvotes: 2