欢迎访问移动开发之家(rcyd.net),关注移动开发教程。移动开发之家  移动开发问答|  每日更新
页面位置 : > > 内容正文

windows phone开发之 listbox分页加载数据

来源: 开发者 投稿于  被查看 29781 次 评论:38

windows phone开发之 listbox分页加载数据


private void listbox1_MouseMove(object sender, MouseEventArgs e) 

    if (Result[0] == "1") 
    { 
        //获取listbox的子类型ScrollViewer             
        ScrollViewer scrollViewer = FindChildOfType<ScrollViewer>((ListBox)sender); 
        if (scrollViewer == null) 
        { 
            throw new InvalidOperationException("erro"); 
        } 
        else 
        { 
            //www.2cto.com 判断当前滚动的高度是否大于或者等于scrollViewer实际可滚动高度,如果等于或者大于就证明到底了 
            if ((scrollViewer.VerticalOffset + 1) >= scrollViewer.ScrollableHeight) 
            { 
                MessageBox.Show("aaa"); 
            } 
        } 
    } 

 
//获取子类型         
public static T FindChildOfType<T>(DependencyObject root) where T : class 

    var queue = new Queue<DependencyObject>(); 
    queue.Enqueue(root); 
    while (queue.Count > 0) 
    { 
        DependencyObject current = queue.Dequeue(); 
        for (int i = VisualTreeHelper.GetChildrenCount(current) - 1; 0 <= i; i--) 
        { 
            var child = VisualTreeHelper.GetChild(current, i); 
            var typedChild = child as T; 
            if (typedChild != null) 
            { 
                return typedChild; 
            } 
            queue.Enqueue(child); 
        } 
    } 
    return null; 


摘自 fengyarongaa

相关文章

    暂无相关文章
相关频道:

用户评论