windows phone开发之 listbox分页加载数据
程序员文章站
2022-05-18 18:15:10
private void listbox1_mousemove(object sender, mouseeventargs e)
{
i...
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
{
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
上一篇: 第三届中国云计算应用论坛即将开幕