获取某些成员使用DataPager的和DataGrid [英] Getting to certain member using datapager and datagrid

查看:167
本文介绍了获取某些成员使用DataPager的和DataGrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我有一个显示有记录包括总量PagedCollectionView一个DataGrid。

I have a DataGrid showing a PagedCollectionView which has the total amount of records included.

在我们总共大约有4220条记录,每页20条记录显示我们有大约210页。

In total we have about 4220 records, with 20 records showing per page we have about 210 pages.

现在我一直在努力实现这一点:

Now I've been trying to implement this:

当我搜索一个人我想有这个人在页面的顶部显示,并有页面设置为任何内容的页面不久,那将是

When I search for a person I want to have this person show on top of the page AND have the page set to anything that is near the page it would be on.

我设法使用的LINQ给出的例子,顶得上的人获取更高的项目那么姓氏但是PagedCollectionview得到由这些结果自动覆盖。由于这一切都跳过了通缉犯之前的页面不同的金额。

I managed to get the person on top using the example given in Linq Get items higher then lastname however the PagedCollectionview gets overwriten by these results. Since this skips everything before the wanted person the amount of pages differs.

所以basicly我想要的是有一个searchfield在那里我可以输入一月。然后我想在页面跳转到页面里扬可能是(+/- 1更高或更低页),并有扬作为第一条记录。

So basicly what I want is to have a searchfield where I can enter "Jan". And then I want the page to jump to the page where Jan could be (+/- 1 page lower or higher) and have "Jan" as first record.

推荐答案

找到我自己的答案。

不要在一个很不错的方法,但是,因为首先被加载在所有时间成员的总金额,我创建了一个检查,看看是否当前加载量高于第一次加载的总金额。

Not in a very nice way but, since at all times firstly the total amount of members is being loaded, I created a check to see if the currently loaded amount is higher then the total amount first loaded.

我爱:

if (loadOperation.TotalEntityCount >= itemCount || !string.IsNullOrEmpty(FilterText))
{
    this.ItemCount = loadOperation.TotalEntityCount;
}
else
{
    if (!DeleteMember)
    {
        pageIndex = (int)((this.ItemCount - loadOperation.TotalEntityCount) / this.PageSize);
        RaisePropertyChanged("PageIndex");
    }
    else
    {
        DeleteMember = false;
        itemCount -= 1;
    }
}

该删除成员,以确保它不会尝试设置页面索引时的成员将被删除,因此TotalEntityCount会低于1,则ITEMCOUNT。

The delete member is to make sure it doesn't try to set the page index when a member is deleted and thus TotalEntityCount would be 1 lower then itemcount.

这篇关于获取某些成员使用DataPager的和DataGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆