我正在尝试将ObservableCollection绑定到我的DataGrid。该集合为空,但DataGrid显示5个空行。关于会导致这种情况的任何想法?
<DataGrid AutoGenerateColumns="true" Name="dgBills" Grid.Row="0" Margin="10, 10, 10, 5" Background="DarkRed" ItemsSource="{Binding Source=Bills}">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Date" Width="1*" Binding="{Binding NextDueDate}" />
<DataGridTextColumn Header="Desc" Width="1*" Binding="{Binding Description}" />
<DataGridTextColumn Header="Amount" Width="1*" Binding="{Binding Amount}" />
<DataGridTextColumn Header="Frequency" Width="1*" Binding="{Binding Frequency}" />
</DataGrid.Columns>
</DataGrid>