【发布时间】:2011-07-24 21:02:16
【问题描述】:
我在执行此操作时遇到了很大的问题,我希望有人可以将我置于他们的保护之下并帮助指导我完成此操作。
我的问题是不知道如何在通过绑定到我的网站的自定义 RSS 提要获取第一组 15 项后将更多项目动态添加到列表框中,并将其添加到我的 windows phone 7 中。
我正在考虑将我的 RSS 提要限制为 15 个项目,这样订阅者就不会被提要中的数千个项目所淹没。
但是,这给我的手机编码时带来了问题。如果我将我的 RSS 提要限制为 15 个最近的项目,我如何获得这 15 个之外的先前项目,以及另一个问题,如何加载它们?
我已经有了我的 RSS 提要课程,并且我可以在手机中成功获取我的 RSS 提要。那不是问题。再次声明——一旦我在 windows phone 7 中加载了我最初的 15 个项目,如果我将我的 RSS 项目保存在我的网站 xml 中一次保持 15 个项目,我如何加载额外的 15 个项目(再次,所以我不'没有一个 RSS 提要,每次一个人加载它时都会包含 1000 多个项目)
感谢任何帮助。
页面 CS:
private void Button_Click(object sender, RoutedEventArgs e)
{
RssService.GetRssItems(
WindowsPhoneBlogPosts,
(items) => { listbox.ItemsSource = items; },
(exception) => { MessageBox.Show(exception.Message); },
null
);
}
页面 XAML:
<ListBox x:Name="listbox" Grid.Row="1" SelectionChanged="listbox_SelectionChanged" Style="{StaticResource ListBoxStyle1}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<Image x:Name="aaa" Grid.Row="0" HorizontalAlignment="Left" Height="60" Width="60" Source="{Binding Url}"/>
<TextBlock Grid.Row="1" Text="{Binding PublishedDate}" Foreground="Green" />
<TextBlock Grid.Row="2" TextWrapping="Wrap" Text="{Binding PlainSummary}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
同一页面 Xaml:
<phone:PhoneApplicationPage.Resources>
<Style x:Key="ListBoxStyle1" TargetType="ListBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ScrollViewer x:Name="ScrollViewer" Background="{TemplateBinding Background}">
<StackPanel>
<ItemsPresenter/>
<Button x:Name="thebutton" Content="Button" Visibility="{Binding LoadMore}"/>
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
【问题讨论】:
-
好的,你有提要,这不是问题,那是什么??
-
问题是(可能是我对 RSS 提要缺乏了解)如果我将我的 RSS 提要限制为 15 项.. 说从现在起一个月后我有 500 项,但我仍然只有显示最近的 15 个 .. 当我想点击“加载更多”按钮时,如何让我的手机显示之前的 485? (把它们分成小块,说..每次加载 15 个?)
标签: c# silverlight rss listbox windows-phone