In my class ResultEntity
if I do:
_resultMulti = new List();
I see the following error message:
You are adding your DataGridTextColumns
directly as items of the DataGrid
, thus you are setting both the Items
and ItemsSource
property and you can only use one at the same time. Fix your columns configuration by using the Columns
attached property:
<DataGrid.Columns>
<DataGridTextColumn Header="Task" IsReadOnly="True" Binding="{Binding TaskName}"/>
<DataGridTextColumn Header="ABBC" IsReadOnly="True" Binding="{Binding ABBC.DisplayString}"/>
<DataGridTextColumn Header="BBCA" IsReadOnly="True" Binding="{Binding BBCA.DisplayString}"/>
<DataGridTextColumn Header="CCCA" IsReadOnly="True" Binding="{Binding CCCA.DisplayString}"/>
</DataGrid.Columns>
Just wrap your column definitions with DataGrid.Columns. As you are binding it using ItemsSource you can't put any direct content in the definition. It is considering your columns as items of the grid which can't go with ItemsSource collection.