我在这里得到坚果与此:如何在绑定到ObservableCollection时删除DataGrid的空白行<T>?
ObservableCollection<Employee> list = new ObservableCollection<Employee>();
dgEmployees.ItemsSource = list;
当您调试列表中的变量,它是空的(list.Count = 0),但后来我把它绑定到一个DataGrid(WPFToolkit),它为我一排空白。
在立即窗口中,dgEmployees.Items它显示:
dgEmployees.Items[0]
{NewItemPlaceholder}
和
dgEmployees.Items[0].GetType()
{Name = "NamedObject" FullName = "MS.Internal.NamedObject"}
[System.RuntimeType]: {Name = "NamedObject" FullName = "MS.Internal.NamedObject"}
看来我已经把这个数据网格到一个TabControl后发生的,但我不是确定它与它有关。
有谁知道如何删除这个空行?
你应该接受另一个答案,它比你的 – reggaeguitar 2014-12-11 22:00:35