我在Windows Phone 8应用程序中有LongListSelector
(在PivotItem
)控件。我看到一个奇怪的行为。有时LLS停止滚动。像冻结一样,我无法滚动它。但我可以使用AppBar
,Pivot
,Button Back
等,甚至GroupHeader和JumpList。它随机发生(到目前为止我没有发现规律性)并且经常发生。早些时候我经常使用LLS,但这些问题从来都没有。LongListSelector停止滚动并冻结
以下是LLS可以冻结的典型场景。
- 转到使用LLS的页面。
- 滚动LLS。
- 点击LLS项目并导航到其他页面。
- 回到LLS页面。
- LLS不滚动。
这个包也可以以其他方式发生。
亮点:
- 我也不大集合结合LLS(我的收藏约10 - 50项(5组))。
- 当LLS没有冻结时,它的工作速度非常快,没有混蛋。
- 我有一个
ListBox
(1 - 6个字符串元素)在LLS项目中。 - 我用DataTemplateSelector(as implemented here)
- 剖析不显示响应较差,当LLS冻结
我的XAML:。
<phone:LongListSelector Name="LLSSimpleSearch" VirtualizingStackPanel.VirtualizationMode="Recycling"
ItemsSource="{Binding ListGroup}"
toolkit:TiltEffect.IsTiltEnabled="True"
Margin="12,0,-12,0"
IsGroupingEnabled="True"
LayoutMode="List"
HideEmptyGroups="False"
GroupHeaderTemplate="{StaticResource LLSHeaderTemplate}"
JumpListStyle="{StaticResource LLSJumpList}"
ListFooterTemplate="{StaticResource LLSListFooter}">
的ItemTemplate
<questionary:QuestTemplateSelector Content="{Binding}">
<questionary:QuestTemplateSelector.Template1>
<DataTemplate>
<ListBox></ListBox> <!-- ListBox with small collect-->
</DataTemplate>
<questionary:QuestTemplateSelector.Template1>
<questionary:QuestTemplateSelector.Template2>
<DataTemplate>
</DataTemplate>
</questionary:QuestTemplateSelector.Template2>
<questionary:QuestTemplateSelector.Template3>
<DataTemplate>
</DataTemplate>
</questionary:QuestTemplateSelector.Template3>
<questionary:QuestTemplateSelector.Template4>
<DataTemplate>
</DataTemplate>
</questionary:QuestTemplateSelector.Template4>
</questionary:QuestTemplateSelector>
在CS:
LLSSimpleSearch.DataContext = GYSearchViewModel.Instance;
GYSearchViewModel.Instance.Load();
视图模型
private ObservableCollection<Group<Quest>> _listGroup = new ObservableCollection<Group<Quest>>();
public ObservableCollection<Group<Quest>> ListGroup
{
get
{
return _listGroup;
}
set
{
if (value != _listGroup)
{
_listGroup = value;
NotifyPropertyChanged("ListGroup");
}
}
}
public Load()
{
MyDataSource.Load((r) => { ListGroup= r; })
}
有点怪怪的?在这个代码中,有潜在的问题?如果需要,我准备提供更多评论。提前感谢您的建议。
UPDATE(问题的解决)
我不能肯定100%,但99%是在ListBox
问题。
<questionary:QuestTemplateSelector.Template1>
<DataTemplate>
<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
</DataTemplate>
<questionary:QuestTemplateSelector.Template1>
我必须在列表中显示我的数据,我用ListBox
内LLS
。实验方式,经过长时间的测试,我发现了冻结的规律性。然后得出结论,在ListBox
的问题。在问题属性IsHitTestVisible
帮助。
<questionary:QuestTemplateSelector.Template1>
<DataTemplate>
<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled"
IsHitTestVisible="false"/>
</DataTemplate>
<questionary:QuestTemplateSelector.Template1>
现在没问题。
感谢您的建议,明天我会尝试将静态数据绑定到LLS并从项目中删除列表框。我会在后更新中介绍结果。 – Alexandr
OmegaMan,我更新了我的帖子,认为我想出了问题。 – Alexandr