【发布时间】:2014-06-06 16:55:02
【问题描述】:
我有一个DataGrid 可以加载大量项目,因此我将ItemsSource 设置为IsAsync=True。
<DataGrid Name="OrdersGrid" ItemsSource="{Binding Path=Orders, IsAsync=True}" />
除了在我的 UserControl 子类构造函数中更改 NewItemPlaceHolderPosition 之外,一切似乎都运行良好。
((IEditableCollectionView)OrdersGrid.Items).NewItemPlaceholderPosition = NewItemPlaceholderPosition.AtBeginning;
我认为这会崩溃,因为您无法将其设置为空网格,这是我在异步 ItemsSource 绑定之前所拥有的。
那么在我尝试更改NewItemPlaceholderPosition 之前,我应该将上述行放在哪里以确保DataGrid 已加载?我需要像“DataGridFinishedLoading”这样的东西,但我不知道有什么可用的。
【问题讨论】: