DataPager和Datagrid,如何移动到当前所选项目的页面
在 Silverlight 项目中,我有一个包含案例列表(DataGrid)的视图。该列表使用 DataPager 进行分页。我的源集合包装在 PagedCollectionView 中。
创建项目后,它会添加到列表中并在 DataGrid 中设置为选定项目,具体取决于列表排序,这可能位于数据分页器中当前活动的另一个页面上。
您将如何将数据分页器移动到新添加项目的页面?
public PagedCollectionView<CaseDTO> Cases { get; set; }
public void CreateCase()
{
var requestDispatcher = container.GetInstance<IAsyncRequestDispatcher>();
requestDispatcher.Add(GetRequest<CreateCaseRequest>());
requestDispatcher.Add(GetRequest<GetCasesRequest>());
requestDispatcher.ProcessRequests(
responses =>
{
selectedCaseId = responses.Get<CreateCaseResponse>().CaseId;
UpdateCases(responses.Get<GetCasesResponse>());
Cases.MoveToPageOf(SelectedCase); // How to implement?
},
ex => { throw new Exception(ex.ToString()); }
);
}
Cases.MoveToPageOf(SelectedCase); // 如何实现?
In a Silverlight project I have a view with a list (DataGrid) of cases. The list is paged with DataPager. My source collection is wrapped in an PagedCollectionView.
When an item is created it is added to the list and set as selecteditem in the DataGrid, depending on the list sorting, this could be on another page the the current active in the datapager.
How would you go about moving the datapager to the page of newly added item?
public PagedCollectionView<CaseDTO> Cases { get; set; }
public void CreateCase()
{
var requestDispatcher = container.GetInstance<IAsyncRequestDispatcher>();
requestDispatcher.Add(GetRequest<CreateCaseRequest>());
requestDispatcher.Add(GetRequest<GetCasesRequest>());
requestDispatcher.ProcessRequests(
responses =>
{
selectedCaseId = responses.Get<CreateCaseResponse>().CaseId;
UpdateCases(responses.Get<GetCasesResponse>());
Cases.MoveToPageOf(SelectedCase); // How to implement?
},
ex => { throw new Exception(ex.ToString()); }
);
}
Cases.MoveToPageOf(SelectedCase); // How to implement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现最好的方法就是搜索页面。我制作了以下扩展方法来做到这一点:
I found the best way was just to search for the page. I made the following extension method that does just that: