
|
When I set AutoGenerateColumns = false, then I see no data. I see the data when AutoGenerateColumns = True. Here's my grid:
<DataGrid Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="5"
ItemsSource="{Binding AccountItems}"
SelectedItem="{Binding SelectedAccountItem}"
AutoGenerateColumns="True">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Date"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding DisplayDate}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Memo 1"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Memo1}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Memo 2"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Memo2}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Debit"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Debit}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Credit"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Credit}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Balance"
Width="SizeToCells"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Balance}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
What am I doing wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|

|
Kenneth Haugland wrote: Windows Forms Designer
He's talking about WPF, not Windows Forms, and he's put what looks like well formed templates in there.
|
|
|
|

|
Hard to say from that - we only have half the picture here. Tell you what, what do you see if you change the DataGridTemplateColumns into DataGridTextColumns? What appears in the text? Is the source correct then?
|
|
|
|

|
That did it. Thanks Pete
If it's not broken, fix it until it is
|
|
|
|
|