虚位以待(AD)
虚位以待(AD)
首页 > 软件编程 > WindowsPhone/WindowsMobile > windows phone开发之 listbox分页加载数据

windows phone开发之 listbox分页加载数据
类别:WindowsPhone/WindowsMobile   作者:码皇   来源:互联网   点击:

private void listbox1_MouseMove(object sender, MouseEventArgs e){ if (Result[0] == "1") { 获取listbox的子类型ScrollViewer ScrollViewer scrollViewer = FindChildOfType<ScrollViewer>
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
相关热词搜索: windows phone 开发