Reputation: 881
everything looks fine from my point of view, but the dataGrid shows only the first item which has been added to the grid.
The XAML part:
<DataGrid HorizontalAlignment="Stretch" Name="dataGridIE"
VerticalAlignment="Stretch" HeadersVisibility="All" CanUserReorderColumns="False" CanUserResizeColumns="False"
AutoGenerateColumns="True" ColumnWidth="100" CanUserAddRows="True" CanUserDeleteRows="True"
Height="97" Margin="23,38,16,38" Grid.ColumnSpan="2" Width="682">
<!--<DataGrid.Columns>
<DataGridTextColumn Header="Key" Binding="{Binding Key}" />
<DataGridTextColumn Header="Value" Binding="{Binding Value.xPath}" />
</DataGrid.Columns>-->
</DataGrid>
Declarative part for the list(code behind):
private List<IEGridViewEntry> _fillEntryDictionary;
The struct, that needs to be bound:
public struct IEGridViewEntry //: INotifyPropertyChanged
{
private ...
public string wordPlaceHolder
{
get { return _wordPlaceHolder; }
set { _wordPlaceHolder = value; }
}
...
};
The way I fill it:
_fillEntryDictionary.Add(new IEGridViewEntry(refHtmlElement));
dataGridIE.ItemsSource = _fillEntryDictionary;
When Debugging everything looks good and filled..
_fillEntryDictionary = Count = 2
[0] = {name1.name.IEGridViewEntry}
Copied expression(Debugging):
(new System.Collections.Generic.Mscorlib_CollectionDebugView<name1.name.IEGridViewEntry>(_fillEntryDictionary)).Items[0]
Thanks in advance.
Upvotes: 0
Views: 1206
Reputation: 36
Set ItemsSource="{Binding}" for datagrid, and populate it with setting .DataContext = ObservableColelction, instead of setting a List
Upvotes: 2