具有长Datatemplate的LongListSelector会导致奇怪的跳转问题 [英] LongListSelector with long Datatemplate causes weird jumping issue
问题描述
全部,
我的应用中有一个LLS,当数据模板中有大量数据时,我有一个奇怪的问题。 我有一个用户控件从Web服务器获取信息然后显示它,但如果您在
的datatemplate中放入很多文本块,也会发生此问题。 问题是,当您向下滚动并实现新项目时,长项目会跳到最后,然后长项目会消失。 关于可能导致这种情况的任何想法?
< phone:LongListSelector>
< phone:LongListSelector.ItemTemplate>
< DataTemplate>
< TextBlock Text =" 1" />
...
< TextBlock Text =" 10000" />
< / DataTemplate>
< / phone:LongListSelector.ItemTemplate>
< / phone:LongListSelector>
嗨Mrwizard,
我不能像你的代码片段那样在LongListSelector控件的数据模板中设置多个TextBlock控件,所以我构建了一个项目并绑定了10000个项目LongListSelector控件使用以下代码片段。
< phone:LongListSelector x:Name =" lls"的HorizontalAlignment = QUOT;左"高度= QUOT; 539"余量= QUOT; 41,30,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 384">
< phone:LongListSelector.ItemTemplate>
< DataTemplate>
< TextBlock Text =" {Binding Name}">< / TextBlock>
< / DataTemplate>
< / phone:LongListSelector.ItemTemplate>
< / phone:LongListSelector>
for(int i = 0; i< 10000; i ++)
{
list.Add(new Worker(){Name = " hello" + i.ToString()});
}
lls.ItemsSource = list;该项目工作正常,我无法重现您的问题。
我还测试了一个项目中的大内容,然后将10000个项目绑定到控件,它似乎也可以正常工作。
您是否可以提交一个repro项目,以便在您的OneDrive上清除您的问题,然后在此处共享链接。
问候,
All,
I have a LLS in my app and I have a weird issue when there is a lot of data in the datatemplate. I have a user control that getst information from web server and then displays it, but this issue also happens if you put in a lot of textblocks in the datatemplate. The issue is that as you scroll down and a new item is realized, the long item skips to the end, and then the long item disappears. Any thoughts on what could be causing this?
<phone:LongListSelector> <phone:LongListSelector.ItemTemplate> <DataTemplate> <TextBlock Text="1"/> ... <TextBlock Text="10000"/> </DataTemplate> </phone:LongListSelector.ItemTemplate> </phone:LongListSelector>
Hi Mrwizard,
I cannot set more than once TextBlock control in data template in LongListSelector control like your code snippet, so I build a project and bind 10000 items in LongListSelector control using the following code snippet.
<phone:LongListSelector x:Name="lls" HorizontalAlignment="Left" Height="539" Margin="41,30,0,0" VerticalAlignment="Top" Width="384"> <phone:LongListSelector.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name}"></TextBlock> </DataTemplate> </phone:LongListSelector.ItemTemplate> </phone:LongListSelector> for (int i = 0; i < 10000; i++) { list.Add(new Worker() { Name = "hello" + i.ToString() }); } lls.ItemsSource = list;The project works ok, I cannot reproduce your problem.
I also test with the large content in one item, then bind 10000 items to the control, it seems work ok too.
Can you submit a repro project to make your issue clear on your OneDrive and then share a link here.
Regards,
这篇关于具有长Datatemplate的LongListSelector会导致奇怪的跳转问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!