I have a control LongListSelector(in PivotItem) in a Windows Phone 8 application. I see strange behavior. Once upon a time, LLS stopped scrolling. Like a hang, I can't scroll it. But I can use AppBar, Pivot, Button Backetc. And even GroupHeader and JumpList. This happened by chance (so far I have not found patterns) and quite often. I used to use LLS often, but these problems never happened.
The following is a typical scenario where LLS may freeze.
- Go to the LLS page.
- Scrolling LLS.
- Click the LLS element and go to another page.
- Return to the page using LLS.
- LLS does not scroll.
This bag can occur in other ways.
Main characteristics:
- I do not bind a large collection to LLS (my collection is about 10 - 50 elements (in 5 groups)).
- When LLS does not freeze, it works very quickly and without jerking.
- LLS elements have
ListBox(1 - 6 string elements). - I am using a DataTemplateSelector ( as implemented here) .
- Profiling does not show poor responsiveness when freezing LLS.
My 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>
</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>
In cs:
LLSSimpleSearch.DataContext = GYSearchViewModel.Instance;
GYSearchViewModel.Instance.Load();
ViewModel
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; })
}
Is there something strange here? Are there potential problems in this code? I am ready to give more comments if necessary. Thanks for the advice in advance.
UPDATE (problem solving)
I can't be 100% sure, but 99% is the problem 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>
.