繁体   English   中英

Windows Phone 7动态列表框和RSS feed问题

[英]Windows Phone 7 Dynamic Listbox and RSS feed problems

我在执行此操作时遇到了很大的问题,我希望有人可以把我带到他们的身边,并帮助指导我完成此任务。

我的问题是不知道如何在通过我的定制RSS提要(绑定到我的网站)进入Windows Phone 7中获得第一组15项后,如何动态地向列表框中添加更多项。

我正在考虑将RSS提要限制为15个项目,以便那些订阅者不会被该提要中的数千个项目所淹没。

但是,这在为我的手机编码时会带来问题。 如果我将RSS feed的上限限制为15个最新项目,那么如何才能获得这15个项目之外的先前项目,另一个问题是如何加载它们?

我已经有了RSS feed类,并且可以在手机中成功获取rss feed。 那不是问题。 再次说明-一旦我将最初的15个项目加载到Windows Phone 7中,如果我将网站XML中的RSS项一次保持为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>

你应该阅读约占数据虚拟化 ,以及如何在滚动加载数据 ,最后背后的整个概念virtuailization一般。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM