1
我正在开发WP8应用程序。LongListSelector ItemsPresenter未显示项目
我有一个LongListSelector显示从Web服务获取的项目。 当用户到达列表的末尾时,底部必须有一个“加载更多”按钮才能使Web服务开放并获取更多的项目。
名单有这样的风格来显示按钮:
<Style x:Key="DenouncesDistanceList" TargetType="phone:LongListSelector">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:LongListSelector">
<ScrollViewer x:Name="ScrollViewer">
<StackPanel>
<ItemsPresenter />
<Button x:Name="LoadMoreToList" Click="LoadMoreToList_Click" >Load moremás</Button>
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
当运行这样的手机应用程序显示了按钮,但从来没有显示的项目。 如果我在LongListSelector声明中取出样式属性,则会显示项目,但在重复项目的永不结束的滚动中显示。
这是LongListSelector的定义(有和没有的样式属性):
<phone:LongListSelector x:Name="LisByDistanceListBox" ItemTemplate="{StaticResource ReportListDataTemplate}" Margin="0,0,-24,0" Background="{x:Null}" ItemsSource="{Binding ReportsByDistance}" Width="480" Height="476" VerticalAlignment="Top" Style="{StaticResource DenouncesDistanceList}" />
<phone:LongListSelector x:Name="LisByDistanceListBox" ItemTemplate="{StaticResource ReportListDataTemplate}" Margin="0,0,-24,0" Background="{x:Null}" ItemsSource="{Binding ReportsByDistance}" Width="480" Height="476" VerticalAlignment="Top" />
使用我用一个ListBox具有相同的风格和相同的ItemTemplate和一切LongListSelector之前一直处于良好工作太很多项目都被加载,迫使应用程序出现OutOfMemoryException。
任何帮助?