如何通过下拉项目刷新? [英] How to refresh by pulling down the items?

查看:18
本文介绍了如何通过下拉项目刷新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题有很多答案,但是,在我看来,所有答案都是关于将旧物品放在底部.

这个解决方案:

void resultList_ItemRealized(object sender, ItemRealizationEventArgs e){if (!_viewModel.IsLoading && resultList.ItemsSource != null && resultList.ItemsSource.Count >= _offsetKnob){if (e.ItemKind == LongListSelectorItemKind.Item){if ((e.Container.Content as TwitterSearchResult).Equals(resultList.ItemsSource[resultList.ItemsSource.Count - _offsetKnob])){_viewModel.LoadPage(_searchTerm, _pageNumber++);}}}}

是关于向下滚动时获取项目.

我怎样才能在顶部获得新鲜的内容(而不是底部的更多旧内容)?我怎么知道用户是否正在向上滚动 LongListSelector

解决方案

这里有两篇博文用于为 Windows Phone 7 中的 ListBox(您已标记)完成此操作,并且也适用于 Windows Phone 8

http://sharpgis.net/post/2011/04/03/RefreshBox-for-Windows-Phone-7.aspxhttp://blogs.msdn.com/b/jasongin/archive/2011/04/13/pull-down-to-refresh-a-wp7-listbox-or-scrollviewer.aspx>

两个状态都要设置

ScrollViewer.ManipulationMode ="控制"

there are lots of answers for this question, but, all of them as I see, are about getting old items at the bottom.

this solution:

void resultList_ItemRealized(object sender, ItemRealizationEventArgs e)
{
    if (!_viewModel.IsLoading && resultList.ItemsSource != null && resultList.ItemsSource.Count >= _offsetKnob)
    {
        if (e.ItemKind == LongListSelectorItemKind.Item)
        {
            if ((e.Container.Content as TwitterSearchResult).Equals(resultList.ItemsSource[resultList.ItemsSource.Count - _offsetKnob]))
            {
                _viewModel.LoadPage(_searchTerm, _pageNumber++);
            }
        }
    }
}

is about getting items as you scroll down.

How can I get fresh new content at top (not more old content at the bottom)? how can I know if user is scrolling up the LongListSelector

解决方案

Here are two posts for accomplishing this for the ListBox in Windows Phone 7 (which you have tagged) and will also work for Windows Phone 8

http://sharpgis.net/post/2011/04/03/RefreshBox-for-Windows-Phone-7.aspx http://blogs.msdn.com/b/jasongin/archive/2011/04/13/pull-down-to-refresh-a-wp7-listbox-or-scrollviewer.aspx

Both state to set

ScrollViewer.ManipulationMode ="Control"

这篇关于如何通过下拉项目刷新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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