我尝试获取 DomainCollectionView,但总计数不包括在查询中:
public DomainCollectionView<sys_log> collView
{
get { return (DomainCollectionView<sys_log>)this.GetValue(collViewProperty); }
set
{
this.SetValue(collViewProperty, value);
}
}
public static DependencyProperty collViewProperty = DependencyProperty.Register(
"collView", typeof(DomainCollectionView<sys_log>), typeof(Journal), new PropertyMetadata(null));
this._source = this.maindatacontext.sys_logs;
this._loader = new DomainCollectionViewLoader<sys_log>(this.LoadEntities, this.mdcloaded);
this._view = new DomainCollectionView<sys_log>(this._loader, this._source);
private LoadOperation<sys_log> LoadEntities()
{
EntityQuery<sys_log> temp = mdc.GetSys_logQuery().OrderBy(order => order.Id).Where(c => c.date > DateFrom.SelectedDate.Value && c.date < DateTo.SelectedDate.Value.AddDays(1).AddTicks(-1)).SortAndPageBy(this._view);
temp.IncludeTotalCount = true;
return mdc.Load(temp);
}
void mdcloaded(LoadOperation<Web.sys_log> t)
{
this.collView = _view;
//but this _view.TotalItemCount = -1
dataGrid1.UpdateLayout();
}
dataGrid1 有 ItemSource = collView。如何设置 TotalItemCount 或将其包含在查询中?