1
votes

I'm using the rss reader sample and a listPicker. What I want to do is to pass the rss url from the listPicker item to the webClient.DownloadStringAsync.

**MainPage.xaml**
[...]
<toolkit:ListPicker.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Nazwa}"
                                   Margin="12 0 0 0"
                                   VerticalAlignment="Center"/>
                        <Image Source="/Repertuar;component/Images/open.png" FlowDirection="RightToLeft" />
                    </StackPanel>
                </DataTemplate>
            </toolkit:ListPicker.ItemTemplate>
            <toolkit:ListPicker.FullModeItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="16 21 0 20">
                        <TextBlock Text="{Binding Nazwa}"
                                   FontSize="43"/>
                    </StackPanel>
                </DataTemplate>
            </toolkit:ListPicker.FullModeItemTemplate>
[...]

.

**MainPage.xaml.cs**
[...]
public class Miasto
{
    public string Nazwa
    {
        get;
        set;
    }

    public string Adres
    {
        get;
        set;
    }
}

public partial class MainPage : PhoneApplicationPage
{
    // Constructor
    public MainPage()
    {
        InitializeComponent();
        IEnumerable<Miasto> source = this.GetDataSource();
        this.listPicker.ItemsSource = source;
    }
    private IEnumerable<Miasto> GetDataSource()
    {
        List<Miasto> source = new List<Miasto>();
        source.Add(new Miasto() { Nazwa = "Bydgoszcz", Adres = "http://film.wp.pl/rss.xml?id=10" });
        source.Add(new Miasto() { Nazwa = "GdaƄsk", Adres = "http://film.wp.pl/rss.xml?id=27" });
        return source;
    }
[...]
    webClient.DownloadStringAsync(new System.Uri("http://film.wp.pl/rss.xml?id=27"));
[...]

I have no clue on how to solve this. Is there an easy solution for this issue?

1

1 Answers

0
votes

You can pass the id to the url on the selection change event. Are you trying to preload the information on the list item?