Quantcast
Channel: Windows Phone 7 Dynamic Listbox and RSS feed problems - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Windows Phone 7 Dynamic Listbox and RSS feed problems

0
0

I am having a huge problem with doing this, and I am hoping someone can take me under their wing and help guide me through this.

My problem is not knowing how to dynamically add more items to the listbox after getting the first set of 15 through my custom made RSS feed, tied to my website, into my windows phone 7.

I am thinking of limiting my RSS feed to 15 items, so that those who subscribe will not be inundated with thousands of items in the feed.

However, this poses a problem when coding for my phone. If I cap my RSS feed to the 15 most recent items, how can I obtain the prior ones outside of these 15, and the other problem, how to load them?

I already have my RSS feed classes, and I can successfully obtain my rss feed in my phone. That is not the problem. Again stated -- once I load my initial 15 items in the windows phone 7, how can I load additional sets of 15, if I keep my RSS items in my website xml kept to 15 items at a time (again, so that I don't have an RSS feed with 1000s of items every time a person loads it)

Any help is appreciated.

Page CS:

private void Button_Click(object sender, RoutedEventArgs e)
    {
        RssService.GetRssItems(
            WindowsPhoneBlogPosts,
            (items) => { listbox.ItemsSource = items; },
            (exception) => { MessageBox.Show(exception.Message); },
            null
            );
    }

Page 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>

Same page 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>

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images